docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class StringVariable

    An IVariable implementation that holds a single string value.

    Inheritance
    object
    Variable<string>
    StringVariable
    StringGlobalVariable
    Implements
    IVariableValueChanged
    IVariable
    ISerializationCallbackReceiver
    Inherited Members
    Variable<string>.ValueChanged
    Variable<string>.Value
    Variable<string>.GetSourceValue(ISelectorInfo)
    Variable<string>.ValueUXML
    Namespace: UnityEngine.Localization.SmartFormat.PersistentVariables
    Assembly: Unity.Localization.dll
    Syntax
    [Serializable]
    [DisplayName("String", null)]
    [Obsolete("Use Unity.SmartStrings.PersistentVariables.StringVariable from the SmartStrings module instead.")]
    [UxmlObject]
    public class StringVariable : Variable<string>, IVariableValueChanged, IVariable, ISerializationCallbackReceiver
    Remarks

    This class is serializable. You can use it in the Inspector. Modifying its Value triggers the ValueChanged event, automatically updating any Smart Strings displaying the value.

    Examples

    The following example shows how to create a BoolVariable and use it in a LocalizedString.

    The following example shows how to create a SByteVariable and use it in a LocalizedString.

    The following example shows how to create a DoubleVariable and use it in a LocalizedString.

    Implements

    IVariableValueChanged
    IVariable
    ISerializationCallbackReceiver
    In This Article
    Back to top
    Copyright © 2026 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)