docs.unity3d.com
Search Results for

    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>
    Inherited Members
    Parameter.GetDisplayName(Type)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.Perception.Randomization.Parameters
    Assembly: Unity.Perception.Runtime.dll
    Syntax
    [Serializable]
    public class CategoricalParameter<T> : CategoricalParameterBase
    Type Parameters
    Name Description
    T

    The sample type of the categorical parameter

    Properties

    Count

    Returns the number of stored categories

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int

    The number of stored categories

    categories

    Returns a list of the potential categories this parameter can generate

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

    sampleType

    The sample type generated by this parameter

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

    samplers

    Returns an IEnumerable that iterates over each sampler field in this parameter

    Declaration
    public override IEnumerable<ISampler> samplers { get; }
    Property Value
    Type Description
    IEnumerable<ISampler>
    Overrides
    Parameter.samplers

    Methods

    GenericSample()

    Generates a generic sample

    Declaration
    public override object GenericSample()
    Returns
    Type Description
    object

    The generated sample

    Overrides
    Parameter.GenericSample()

    GetCategory(int)

    Returns the category stored at the specified index

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

    The index of the category to lookup

    Returns
    Type Description
    T

    The category stored at the specified index

    GetCategoryCount()

    Returns the number of stored categories

    Declaration
    [Obsolete("GetCategoryCount method has been deprecated. Please use Count (UnityUpgradable)")]
    public int GetCategoryCount()
    Returns
    Type Description
    int

    The number of stored categories

    GetProbability(int)

    Returns the probability value stored at the specified index

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

    The index of the probability value to lookup

    Returns
    Type Description
    float

    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, float)>)

    Updates this parameter's list of categorical options

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

    The categorical options to configure

    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

    Validate()

    Validates the categorical probabilities assigned to this parameter

    Declaration
    public override void Validate()
    Overrides
    Parameter.Validate()
    Exceptions
    Type Condition
    ParameterValidationException
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)