In Unity Docs found: https://docs.unity3d.com/scriptreference/ Events.UnityAction.html
It seems to be understood that it can store variables, and the type void
.
But did not fully understand how it works, and can he do something else.
Here are these:
- Event System.action
- delegates
Answer 1, Authority 100%
Store variables and Void type
UnityAction
– This is essentially a delegate (unityaction ()
, in general, void delegate
). If in simple, then columns. If you need to subscribe to some event, then here UNITYACTION
and you should use.
In essence, in the example of the link, everything explains:
// Add a subscriber
M_MYFIRSTACTION + = MyFunction;
// Subscribe to the button Pressing the button
// When the button is pressed, all the subscribers from M_MYFIRSTICTION will receive a notification
m_addbutton.onclick.addlistener (M_MYFIRSTAction);