Interface ITraitBasedStateData<TObject> | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Interface ITraitBasedStateData<TObject>

    A specialized interface of IStateData for trait-based domains

    Namespace: Unity.AI.Planner.DomainLanguage.TraitBased
    Syntax
    public interface ITraitBasedStateData<TObject> : IStateData where TObject : struct, IDomainObject
    Type Parameters
    Name Description
    TObject

    Object type

    Methods

    AddDomainObject(ComponentType[], String)

    Add a domain object to a state

    Declaration
    (TObject, DomainObjectID)AddDomainObject(ComponentType[] types, string name)
    Parameters
    Type Name Description
    ComponentType[] types

    Trait types to initialize the domain object with

    System.String name

    Name of the domain object

    Returns
    Type Description
    System.ValueTuple<TObject, DomainObjectID>

    Domain object and ID

    GetTraitOnObject<TTrait>(TObject)

    Get trait data for a domain object

    Declaration
    TTrait GetTraitOnObject<TTrait>(TObject domainObject)
        where TTrait : struct, ITrait
    Parameters
    Type Name Description
    TObject domainObject

    Domain object

    Returns
    Type Description
    TTrait

    Specified trait data

    Type Parameters
    Name Description
    TTrait

    Trait type

    RemoveDomainObject(TObject)

    Remove a domain object from a state

    Declaration
    bool RemoveDomainObject(TObject domainObject)
    Parameters
    Type Name Description
    TObject domainObject

    Domain object to remove

    Returns
    Type Description
    System.Boolean

    Whether the domain object was removed or not

    RemoveTraitOnObject<TTrait>(ref TObject)

    Remove a trait from a domain object

    Declaration
    bool RemoveTraitOnObject<TTrait>(ref TObject domainObject)
        where TTrait : struct, ITrait
    Parameters
    Type Name Description
    TObject domainObject

    Domain object

    Returns
    Type Description
    System.Boolean

    Whether the trait was removed

    Type Parameters
    Name Description
    TTrait

    Trait type

    SetTraitOnObject(ITrait, ref TObject)

    Set/update trait data on a domain object

    Declaration
    void SetTraitOnObject(ITrait trait, ref TObject domainObject)
    Parameters
    Type Name Description
    ITrait trait

    Trait data (causes boxing)

    TObject domainObject

    Domain object

    SetTraitOnObject<TTrait>(TTrait, ref TObject)

    Set/update trait data on a domain object

    Declaration
    void SetTraitOnObject<TTrait>(TTrait trait, ref TObject domainObject)
        where TTrait : struct, ITrait
    Parameters
    Type Name Description
    TTrait trait

    Trait data

    TObject domainObject

    Domain object

    Type Parameters
    Name Description
    TTrait

    Trait type

    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