docs.unity3d.com
    Show / Hide Table of Contents

    Class Variable<T>

    Base class for all single source variables. Inhterit from this class for storage for a single serialized source value that will send a value changed event when Value is changed. This will trigger any LocalizedString that is currently using the variable to update.

    Inheritance
    Object
    Variable<T>
    GlobalVariable<T>
    BoolVariable
    FloatVariable
    IntVariable
    NestedVariablesGroup
    ObjectVariable
    StringVariable
    Namespace: UnityEngine.Localization.SmartFormat.PersistentVariables
    Syntax
    public class Variable<T> : object, IVariableValueChanged, IVariable
    Type Parameters
    Name Description
    T

    The value type to store in this variable.

    Properties

    Value

    The value for this variable. Changing this will trigger the ValueChanged event.

    Declaration
    public T Value { get; set; }
    Property Value
    Type Description
    T

    Methods

    GetSourceValue(ISelectorInfo)

    The value that will be used when the smart string matches this variable. This value can then be further used by additional sources/formatters.

    Declaration
    public object GetSourceValue(ISelectorInfo _)
    Parameters
    Type Name Description
    ISelectorInfo _
    Returns
    Type Description
    Object
    Implements
    IVariable.GetSourceValue(ISelectorInfo)

    Events

    ValueChanged

    Called when Value is changed.

    Declaration
    public event Action<IVariable> ValueChanged
    Event Type
    Type Description
    Action<IVariable>
    Implements
    IVariableValueChanged.ValueChanged
    In This Article
    • Properties
      • Value
    • Methods
      • GetSourceValue(ISelectorInfo)
    • Events
      • ValueChanged
    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