docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Dictionary source

    The Dictionary source extracts objects with a matching Key from an IDictionary or IDictionary<string, object>.

    When evaluating an IDictionary, if the Key is not a string, the Dictionary source first converts it to a string using the object’s ToString method. The case sensitivity of the comparison is determined by the Smart Form Case Sensitivity option.

    Example Smart String Arguments Result
    {SomeKey}
    new Dictionary<string, object>() { { "SomeKey", 999 } }
    
    999
    Hello {Name} {Surname}
    new Dictionary<string, string>(){ { "Name", "Gordon" }, { "Surname", "Freeman" }, }
    
    Hello Gordon Freeman
    {Name} {Surname} scored {1:Score} points
    new Dictionary<string, string>(){ { "Name", "Gordon" }, { "Surname", "Freeman" }, },
    new Dictionary<string, object>() { { "Score", 153 } }
    
    Gordon Freeman scored 153 points

    The following example shows how a dictionary could be provided as an argument.

    var localizedString = new LocalizedString("My Table", "My Table Entry");
    var dict = new Dictionary<string, string> { { "Name", "Gordon" }, { "Surname", "Freeman" } };
    localizedString.Arguments = new object[] { dict };
    
    In This Article
    Back to top Copyright © 2025 Unity Technologies — Terms of use
    Generated by DocFX
    on Monday, January 20, 2025