docs.unity3d.com
    Show / Hide Table of Contents

    Reflection source

    The Reflection source is used to select using .Net Reflection. Named placeholders are evaluated against the current object. The Reflection Source can be used to extract an object from a property, field or method.

    Note: When using a method, the method must be parameterless and not return void.

    Example Smart String Arguments Result
    The value is {gameObject.name}
    gameObject.GetComponent<Camera>()
    
    The value is Camera
    You can call methods to modify values such as {0.ToUpper}
    "Hello World"
    
    You can call methods to modify values such as HELLO WORLD
    You can call methods to modify values such as {0.ToUpper}
    "Hello World"
    
    You can call multiple methods to modify values such as H' E' L' L' O' ' W' O' R' L' D
    My name is {Name} and I am {Age} years old.
    public class Person
    {
        public int Age = 39;
        public string Name = "Juan Pérez";
    }
    
    new Person()
    
    My name is Juan Pérez and I am 39 years old.
    Mr {name.ToCharArray.0} {surname}
    new { name = "Yamada", surname = "Taro" }
    
    Mr Y Taro
    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