- Home /
How to Get a Value From a Property or Method Defined in the Inspector (Think Reversed UnityEvent)
The situation: I have many UI text elements that I want to display a specific value of an object. They are not all displaying the same property or the same object. If I wanted to set the values in a script, I'd need a script for each kind of object I want to get data from, or to use slow reflection to get a property.
What I would like to do, is to have a script that can set the text to some value of a method I define in the editor, using an interface kind of similar to the On Change hooks most UI elements have:
Where I could attach this to a gameObject in the hierarchy that has a UI text element, drag in another object, and choose what property/function to get the string I want. Is there a built in Unity way to do this? Would I need to use Reflection and custom property drawers to achieve this?
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Trigger Sound more than Once 0 Answers
Should I be using activeInHierachy or activeself? - c# 3 Answers
Snap to scrollview elements 1 Answer