docs.unity3d.com
    Show / Hide Table of Contents

    Class Relation<T>

    Generic form of Relation, which provides RateDataMatch and other methods

    Inheritance
    Object
    ConditionBase
    RelationBase
    Relation
    Relation<T>
    NonBinaryRelation<TRange, TTrait>
    Inherited Members
    Relation.child1TraitName
    Relation.child2TraitName
    Relation.GetRequiredTraits()
    RelationBase.m_Child1
    RelationBase.m_Child2
    RelationBase.child1
    RelationBase.child2
    RelationBase.child1Transform
    RelationBase.child2Transform
    RelationBase.child1Proxy
    RelationBase.child2Proxy
    RelationBase.proxyGroup
    RelationBase.ResetChildrenReferences()
    ConditionBase.proxy
    ConditionBase.drawWarning
    ConditionBase.OnValidate()
    Namespace: Unity.MARS
    Syntax
    public abstract class Relation<T> : Relation, ISimulatable, IRelation<T>, IRelation, IRelationBase, IConditionBase, IRequiresTraits<T>, IRequiresTraits, ICreateFromDataPair
    Type Parameters
    Name Description
    T

    The type of data this relation will be rating

    Methods

    ConformToData(TraitDataSnapshot, TraitDataSnapshot)

    Modifies the properties so that the data is acceptable for this relation

    Declaration
    public virtual void ConformToData(TraitDataSnapshot child1Data, TraitDataSnapshot child2Data)
    Parameters
    Type Name Description
    TraitDataSnapshot child1Data

    The data for child 1 that should pass this relation after this method is called

    TraitDataSnapshot child2Data

    The data for child 2 that should pass this relation after this method is called

    Implements
    ICreateFromDataPair.ConformToData(TraitDataSnapshot, TraitDataSnapshot)

    FormatDataString(TraitDataSnapshot, TraitDataSnapshot)

    Formats data into a string that is human-readable and appropriate for the relation

    Declaration
    public virtual string FormatDataString(TraitDataSnapshot child1Data, TraitDataSnapshot child2Data)
    Parameters
    Type Name Description
    TraitDataSnapshot child1Data

    The data for child 1

    TraitDataSnapshot child2Data

    The data for child 2

    Returns
    Type Description
    String

    The formatted string

    Implements
    ICreateFromDataPair.FormatDataString(TraitDataSnapshot, TraitDataSnapshot)

    OptimizeForData(TraitDataSnapshot, TraitDataSnapshot)

    Modifies the properties so that the data is the optimal data for this relation

    Declaration
    public virtual void OptimizeForData(TraitDataSnapshot child1Data, TraitDataSnapshot child2Data)
    Parameters
    Type Name Description
    TraitDataSnapshot child1Data

    The data that should be optimal for child 1 after this method is called

    TraitDataSnapshot child2Data

    The data that should be optimal for child 2 after this method is called

    Implements
    ICreateFromDataPair.OptimizeForData(TraitDataSnapshot, TraitDataSnapshot)

    RateDataMatch(ref T, ref T)

    Compares the given trait data to the filter function

    Declaration
    public abstract float RateDataMatch(ref T child1Data, ref T child2Data)
    Parameters
    Type Name Description
    T child1Data

    The data being filtered against for the first child

    T child2Data

    The data being filtered against for the second child

    Returns
    Type Description
    Single

    A number from 0 to 1 indicating how well a set of data matches

    Implements
    IRelation<T>.RateDataMatch(ref T, ref T)

    Extension Methods

    IRequiresTraitsMethods.TryGetTraitValue<T>(IRequiresTraits<T>, Int32, String, out T)
    IRequiresTraitsMethods.TryGetAllTraitsWithSemanticTag<T>(IRequiresTraits<T>, String, String, out Dictionary<Int32, T>)
    IRequiresTraitsMethods.ForEachContextIdWithTrait<T>(IRequiresTraits<T>, String, Action<Int32>)
    IRelationGenericMethods.PassesRelation<T>(IRelation<T>, ref T, ref T)
    Back to top
    Terms of use
    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