- Home /
How do I add something to the OnClick of a UI Button from an Editor-Script?
I can add a non-persistent listener like this:
myButton.onClick.AddListener( () => Toggle() );
But how do I add a persistent listener that will also show up in the Inspector? I want to do this from an editor-script (form a custom inspector)
Hey, UI Button component already has this kind of facilities. You can add listener through inspector by using "+" sign that is at last in inspector of Button component.
I know I can add it in the inspector, but if I add it via script it doesn't show up in the inspector. I want to add it via script (editor-script even) and have it show up in the inspector!
Your answer
Follow this Question
Related Questions
ShaderGraph-like EditorWindow 0 Answers
Editor Extension Get Current Project View folder. 0 Answers
Place UI element on pointer up position. 1 Answer
Unity 4.6B UI Scrollbar Usage 1 Answer
What is the name of this List-like Editor Control? 2 Answers