- Home /
Adding functions in editor
Hi I was wondering if It's possible to make an script in which you can, in the editor, select a list of functions who will be called when a certain function in the script will be invoked, just like the onClick box in a button script:
Thank you for the help.
What is difficult in making some research ?
Please tell me ...
http://answers.unity3d.com/questions/666127/how-do-i-generate-a-drop-down-list-of-functions-on.html
Answer by Baste · Jul 29, 2015 at 09:28 AM
The OnClick function for a button contains a class called UnityEvent. If you have a public UnityEvent on your script, it will show exactly the same GUI in the inspector as the OnClick box.
You call the UnityEvent by calling it's Invoke method, which will make every function you've added in the inspector be called.
Your answer
Follow this Question
Related Questions
Whether or not to use Unity GUI functions 1 Answer
Changes in variables from function triggered by editor script during edit mode are not applied. 2 Answers
Button not executing function. C# 3 Answers
Missing function in button on click 1 Answer
Add a function listener like button's to custom scripts 2 Answers