Skip to content

Target Filters

Target Filters are used to filter targets for the current decision. Note that a decision may or may not have Target Filters. However:

  1. If the Target Filter list is empty, all utility entities in the world will be the targets for the decision.
  2. If all Target Filters return no targets, then the decision will be scored only once, as if it does not have targets.

Creating Target Filters

  1. To create a new Target Filter, you need to create a class inherited from TargetFilter and override OnFilterTarget method:

    public class ChargeStationFilter : TargetFilter
    {
        public ChargeStationType Type;
    
        protected override bool OnFilterTarget(UtilityEntity target)
        {
            return target.EntityFacade is ChargeStation station && station.Type == Type;
        }
    }
    

  2. To add the Target Filter to the agent, you need to go to Target Filter Tab, select a target filter type, give it a name, and then click the Create button:
    center|400

  3. To attach the Target Filter to a decision, you need to go the the Decision Editor in the Intelligence Tab, select the Target Filter name, then click the Add button:
    Attachments/UtilityIntelligence/Documentation/UtilityAgent/Decisions/attach-target-filter.png

Built-in Target Filters

Currently, we provides these built-in target filters:

  • OtherFilter: The filtered targets are any entities in the utility world, except the current agent.
  • AgentFilter: The filtered targets are any agents in the utility world.

If you find this plugin more valuable than its price, especially when it's on sale, or if you simply want to support me on my development journey, there are currently 3 ways to do so:

1. Leave a 5-star review on the Unity Asset Store.
2. Buy assets through my Affiliate Links. It won't cost you any extra money, and I'll get a commission from Unity.
    • Utility Intelligence: A user-friendly Utility AI Framework
    • Top New Assets
    • Top Paid Assets
    • Top Downloaded Assets
3. Buy me a coffee at Ko-fi. Donation Benefits:
    • Your requests will be prioritized in my todo-list.
    • You'll receive a special role on my Discord server exclusively for donors:
       • Supporter: One-time donation.
       • Patron: Monthly donation.

Thank you so much for your support! 🥰
It allows me to dedicate more time to developing this plugin.


Last update : April 3, 2024
Created : March 31, 2024