Home > Back-end >  How to reference other functions in Unity
How to reference other functions in Unity

Time:11-27

I want to be able to reference other functions inside my script, and then call them. Something like when assigning an on-click event for the button, so I can just drag and drop it in the Inspector. Thanks

CodePudding user response:

You seem to mean a UnityEvent

public UnityEvent someName;

and later on at some point

someName.Invoke();

Otherwise just go via your type like e.g.

public YourOtherScript example;

and then

example.YourMethod();
  • Related