docs.unity3d.com
    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 };
    
    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