Class CategoricalParameter<T> | Perception | 0.5.0-preview.1
docs.unity3d.com
    Show / Hide Table of Contents

    Class CategoricalParameter<T>

    Generates samples by choosing one option from a list of choices

    Inheritance
    Object
    Parameter
    CategoricalParameterBase
    CategoricalParameter<T>
    ColorHsvaCategoricalParameter
    ColorRgbCategoricalParameter
    GameObjectParameter
    MaterialParameter
    StringParameter
    Texture2DParameter
    Inherited Members
    Parameter.GetDisplayName(Type)
    Parameter.ResetState()
    Parameter.IterateState(Int32)
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.Experimental.Perception.Randomization.Parameters
    Syntax
    [Serializable]
    public abstract class CategoricalParameter<T> : CategoricalParameterBase
    Type Parameters
    Name Description
    T

    The sample type of the categorical parameter

    Properties

    categories

    Returns a list of the potential categories this parameter can generate

    Declaration
    public IReadOnlyList<(T, float)> categories { get; }
    Property Value
    Type Description
    IReadOnlyList<ValueTuple<T, Single>>

    sampleType

    The sample type generated by this parameter

    Declaration
    public override sealed Type sampleType { get; }
    Property Value
    Type Description
    Type
    Overrides
    Parameter.sampleType

    Methods

    GenericSample()

    Generates a generic sample

    Declaration
    public override object GenericSample()
    Returns
    Type Description
    Object

    The generated sample

    Overrides
    Parameter.GenericSample()

    GetCategory(Int32)

    Returns the category stored at the specified index

    Declaration
    public T GetCategory(int index)
    Parameters
    Type Name Description
    Int32 index

    The index of the category to lookup

    Returns
    Type Description
    T

    The category stored at the specified index

    GetProbability(Int32)

    Returns the probability value stored at the specified index

    Declaration
    public float GetProbability(int index)
    Parameters
    Type Name Description
    Int32 index

    The index of the probability value to lookup

    Returns
    Type Description
    Single

    The probability value stored at the specified index

    Sample()

    Generates a sample

    Declaration
    public T Sample()
    Returns
    Type Description
    T

    The generated sample

    SetOptions(IEnumerable<T>)

    Updates this parameter's list of categorical options

    Declaration
    public void SetOptions(IEnumerable<T> categoricalOptions)
    Parameters
    Type Name Description
    IEnumerable<T> categoricalOptions

    The categorical options to configure

    SetOptions(IEnumerable<(T, Single)>)

    Updates this parameter's list of categorical options

    Declaration
    public void SetOptions(IEnumerable<(T, float)> categoricalOptions)
    Parameters
    Type Name Description
    IEnumerable<ValueTuple<T, Single>> categoricalOptions

    The categorical options to configure

    Validate()

    Validates the categorical probabilities assigned to this parameter

    Declaration
    public override void Validate()
    Overrides
    Parameter.Validate()
    Exceptions
    Type Condition
    UnityEngine.Experimental.Perception.Randomization.Parameters.ParameterValidationException
    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