docs.unity3d.com
    Show / Hide Table of Contents

    Class GlobalVariablesSource

    Can be used to provide global values that do not need to be passed in as arguments when formatting a string. The smart string should take the format {groupName.variableName}. e.g {global.player-score}. Note: The group name and variable names must not contain any spaces.

    Inheritance
    Object
    GlobalVariablesSource
    Namespace: UnityEngine.Localization.SmartFormat.Extensions
    Syntax
    public class GlobalVariablesSource : object, ISource, IDictionary<string, GlobalVariablesGroup>, ISerializationCallbackReceiver

    Constructors

    GlobalVariablesSource(SmartFormatter)

    Creates a new GlobalVariablesGroup instance and adds the "." operator to the parser.

    Declaration
    public GlobalVariablesSource(SmartFormatter formatter)
    Parameters
    Type Name Description
    SmartFormatter formatter

    Properties

    Count

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

    IsReadOnly

    Declaration
    public bool IsReadOnly { get; }
    Property Value
    Type Description
    Boolean

    IsUpdating

    Has BeginUpdating() been called? This can be used when updating the value of multiple IGlobalVariable in order to do a single update after the updates instead of 1 per change.

    Declaration
    public static bool IsUpdating { get; }
    Property Value
    Type Description
    Boolean

    Item[String]

    Declaration
    public GlobalVariablesGroup this[string name] { get; set; }
    Parameters
    Type Name Description
    String name
    Property Value
    Type Description
    GlobalVariablesGroup

    Keys

    Declaration
    public ICollection<string> Keys { get; }
    Property Value
    Type Description
    ICollection<String>

    Values

    Declaration
    public ICollection<GlobalVariablesGroup> Values { get; }
    Property Value
    Type Description
    ICollection<GlobalVariablesGroup>

    Methods

    Add(KeyValuePair<String, GlobalVariablesGroup>)

    Declaration
    public void Add(KeyValuePair<string, GlobalVariablesGroup> item)
    Parameters
    Type Name Description
    KeyValuePair<String, GlobalVariablesGroup> item

    Add(String, GlobalVariablesGroup)

    Declaration
    public void Add(string name, GlobalVariablesGroup group)
    Parameters
    Type Name Description
    String name
    GlobalVariablesGroup group

    BeginUpdating()

    Indicates that multiple IGlobalVariable will be changed and LocalizedString should wait for EndUpdate before updating. See EndUpdating() and EndUpdate. Note: BeginUpdating() and EndUpdating() can be nested, EndUpdate will only be called after the last EndUpdate.

    Declaration
    public static void BeginUpdating()

    Clear()

    Declaration
    public void Clear()

    Contains(KeyValuePair<String, GlobalVariablesGroup>)

    Declaration
    public bool Contains(KeyValuePair<string, GlobalVariablesGroup> item)
    Parameters
    Type Name Description
    KeyValuePair<String, GlobalVariablesGroup> item
    Returns
    Type Description
    Boolean

    ContainsKey(String)

    Declaration
    public bool ContainsKey(string name)
    Parameters
    Type Name Description
    String name
    Returns
    Type Description
    Boolean

    CopyTo(KeyValuePair<String, GlobalVariablesGroup>[], Int32)

    Declaration
    public void CopyTo(KeyValuePair<string, GlobalVariablesGroup>[] array, int arrayIndex)
    Parameters
    Type Name Description
    KeyValuePair<String, GlobalVariablesGroup>[] array
    Int32 arrayIndex

    EndUpdating()

    Indicates that updates to IGlobalVariable have finished and sends the EndUpdate event. Note: BeginUpdating() and EndUpdating() can be nested, EndUpdate will only be called after the last EndUpdate.

    Declaration
    public static void EndUpdating()

    GetEnumerator()

    Declaration
    public IEnumerator GetEnumerator()
    Returns
    Type Description
    IEnumerator

    OnAfterDeserialize()

    Declaration
    public void OnAfterDeserialize()

    OnBeforeSerialize()

    Declaration
    public void OnBeforeSerialize()

    Remove(KeyValuePair<String, GlobalVariablesGroup>)

    Declaration
    public bool Remove(KeyValuePair<string, GlobalVariablesGroup> item)
    Parameters
    Type Name Description
    KeyValuePair<String, GlobalVariablesGroup> item
    Returns
    Type Description
    Boolean

    Remove(String)

    Declaration
    public bool Remove(string name)
    Parameters
    Type Name Description
    String name
    Returns
    Type Description
    Boolean

    TryEvaluateSelector(ISelectorInfo)

    Declaration
    public bool TryEvaluateSelector(ISelectorInfo selectorInfo)
    Parameters
    Type Name Description
    ISelectorInfo selectorInfo
    Returns
    Type Description
    Boolean
    Implements
    ISource.TryEvaluateSelector(ISelectorInfo)

    TryGetValue(String, out GlobalVariablesGroup)

    Declaration
    public bool TryGetValue(string name, out GlobalVariablesGroup value)
    Parameters
    Type Name Description
    String name
    GlobalVariablesGroup value
    Returns
    Type Description
    Boolean

    UpdateScope()

    Can be used to create a BeginUpdating() and EndUpdating() scope.

    Declaration
    public static IDisposable UpdateScope()
    Returns
    Type Description
    IDisposable

    Events

    EndUpdate

    Called after the final EndUpdating() has been called. This can be used when you wish to respond to value change events but wish to do a single update at the end instead of 1 per change. For example, if you wanted to change the value of multiple global variables that a smart string was using then changing each value would result in a new string being generated, by using begin and end the string generation can be deferred until the final change so that only 1 update is performed.

    Declaration
    public static event Action EndUpdate
    Event Type
    Type Description
    Action

    Extension Methods

    TupleExtensions.IsValueTuple(Object)
    TupleExtensions.GetValueTupleItemObjects(Object)
    TupleExtensions.GetValueTupleItemObjectsFlattened(Object)
    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