docs.unity3d.com
    Show / Hide Table of Contents

    Class LocalizedReference

    Provides a way to reference a table entry inside of a specific LocalizationTable.

    Inheritance
    Object
    LocalizedReference
    LocalizedAsset<TObject>
    LocalizedString
    Namespace: UnityEngine.Localization
    Syntax
    public abstract class LocalizedReference : object

    Properties

    FallbackState

    Can be used to override the default fallback state.

    Declaration
    public FallbackBehavior FallbackState { get; set; }
    Property Value
    Type Description
    FallbackBehavior

    IsEmpty

    Checks whether both TableReference and TableEntryReference contain valid references, and returns true if one of them is empty.

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

    TableEntryReference

    Provides a reference to the entry inside of the table. The entry reference can be the Key name or Id.

    Declaration
    public TableEntryReference TableEntryReference { get; set; }
    Property Value
    Type Description
    TableEntryReference
    Examples

    This example shows the 2 ways a reference can be set.

        var localizedString = new LocalizedString();
    
        // Table Entry Reference can be set with the name of the Key
        localizedString.TableEntryReference = "Exit Game";
    
        // Or the Key Id
        localizedString.TableEntryReference = 342423423;
    See Also
    SetReference(TableReference, TableEntryReference)

    TableReference

    Provides a reference to the LocalizationTable. A table reference can be either the name of the table or the table collection name Guid.

    Declaration
    public TableReference TableReference { get; set; }
    Property Value
    Type Description
    TableReference
    Remarks

    Note: Changing this value triggers an update to any subscribers. See SetReference(TableReference, TableEntryReference) if you wish to change both the table and entry.

    Examples

    This example shows the 2 ways a reference can be set.

        var localizedString = new LocalizedString();
    
        // Table Reference can be set with the name of the table
        localizedString.TableReference = "My String Table";
    
        // Or the Table Collection Guid
        localizedString.TableReference = new System.Guid("6e79ded14bc9e0a4d9bf2b8aac246bfe");

    Methods

    ForceUpdate()

    Declaration
    protected abstract void ForceUpdate()

    Reset()

    Called when values are changed due to a change made via serialization, such as via the inspector.

    Declaration
    protected abstract void Reset()

    SetReference(TableReference, TableEntryReference)

    Sets both the TableReference and TableEntryReference and triggers an update if there are any change subscribers.

    Declaration
    public void SetReference(TableReference table, TableEntryReference entry)
    Parameters
    Type Name Description
    TableReference table

    Reference to the table name of Guid.

    TableEntryReference entry

    Reference to the entry Key name or Id.

    Examples

    This example shows the different ways SetReference can be called.

        var localizedString = new LocalizedString();
    
        // Setting with names
        localizedString.SetReference("UI Text", "Options");
    
        // Setting with the table name and Key Id
        localizedString.SetReference("UI Text", 3432444324);
    
        // Setting with the Table Name Guid and Key name
        localizedString.SetReference(new System.Guid("6e79ded14bc9e0a4d9bf2b8aac246bfe"), "Options");
    
        // Setting with the Table Name Guid and the Key Id
        localizedString.SetReference(new System.Guid("6e79ded14bc9e0a4d9bf2b8aac246bfe"), 3432444324);

    ToString()

    Returns a string representation including the TableReference and TableEntryReference

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    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