- Home /
Select monobehaviour function from inspector
I am trying to find out what variables i need to create so that i can have a script that behaves similarly to a button. I want to be able to drag a monobehaviour into a field in the inspector and then choose the function to call, like you do an a UI button. The selected function would then be called on a "OnTrigger" event.
This is a screenshot of a ui button and it shows the fields to which i am refering.
Answer by FortisVenaliter · Jul 01, 2015 at 07:15 PM
You need to expose a UnityEvent variable in your script. Then, when it comes time to call it, simply call Invoke() on it.
thank you very much, i have been looking for this for awhile
Your answer
Follow this Question
Related Questions
OnTrigger Down, Call the Button's OnClicked event 2 Answers
Display Non Monobehaviour array in inspector C# 1 Answer
Bullet Prefab not instantiating 1 Answer
Button doesn't work 1 Answer