Class BaseAgent<TAgent> | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Class BaseAgent<TAgent>

    Abstract base class for an agent

    Inheritance
    System.Object
    BaseAgent<TAgent>
    Namespace: UnityEngine.AI.Planner.Agent
    Syntax
    public abstract class BaseAgent<TAgent> : MonoBehaviour where TAgent : class
    Type Parameters
    Name Description
    TAgent

    Agent type

    Fields

    m_EntityManager

    Declaration
    protected EntityManager m_EntityManager
    Field Value
    Type Description
    EntityManager

    Properties

    Controller

    The controller which executes plans for the agent.

    Declaration
    public Controller<TAgent> Controller { get; }
    Property Value
    Type Description
    Controller<TAgent>

    Methods

    GetDomainObjectEntityByID(Entity, DomainObjectID)

    Returns the entity of the domain object which is assigned the given ID

    Declaration
    public Entity GetDomainObjectEntityByID(Entity stateEntity, DomainObjectID id)
    Parameters
    Type Name Description
    Entity stateEntity

    Entity for the state containing the domain object

    DomainObjectID id

    ID of the domain object entity to be returned

    Returns
    Type Description
    Entity

    Entity that matches the DomainObjectID

    GetObjectEntities(Entity, Type[])

    Returns domain objects and/or the state entity which possess a set of required traits

    Declaration
    public IEnumerable<Entity> GetObjectEntities(Entity stateEntity, params Type[] traitFilter)
    Parameters
    Type Name Description
    Entity stateEntity

    The state entity containing objects to be filtered and returned

    System.Type[] traitFilter

    The set of traits which objects must possess to be returned

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<Entity>

    Returns domain objects and/or the state entity which possess a set of required traits

    GetObjectTrait<T>(Entity)

    Returns the trait data for a given object entity

    Declaration
    public T GetObjectTrait<T>(Entity objectEntity)
        where T : struct, ITrait<T>
    Parameters
    Type Name Description
    Entity objectEntity

    Entity for the object from which the trait data is to be read

    Returns
    Type Description
    T

    The specified trait data

    Type Parameters
    Name Description
    T

    Trait type

    Heuristic(Entity)

    Overridable method to specify a heuristic

    Declaration
    protected virtual float Heuristic(Entity stateEntity)
    Parameters
    Type Name Description
    Entity stateEntity

    Entity for the state that a heuristic will be provided

    Returns
    Type Description
    System.Single

    Value estimate

    SetObjectTrait<T>(Entity, T)

    Sets the given trait data on the given object entity

    Declaration
    public void SetObjectTrait<T>(Entity objectEntity, T traitData)
        where T : struct, ITrait<T>
    Parameters
    Type Name Description
    Entity objectEntity

    Entity for the object which the trait data is to be set

    T traitData

    Trait data to be set on the given object entity

    Type Parameters
    Name Description
    T

    Trait type

    Update()

    Overridable Update method (called once per frame)

    Declaration
    protected virtual void Update()
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023