- Home /
What is Unityevent and how do they relate to Unityaction?
Hi all. I am sorry if this is too general but the docs don't provide enough for me to grasp this. I understand Unityaction is equivalent to .net action. Is there an equivalent to Unityevent? I am trying to get at how it would be useful. Thanks
Answer by JoeStrout · Apr 24, 2015 at 03:52 AM
UnityEvent is just a standardized sort of callback (C# delegate) with built-in -- and really cool -- support in the Unity editor. This means that you can declare a public UnityEvent on your script, and then in the editor, make this invoke almost any public method or set almost any public property on any component of any object in the scene.
This is a really powerful way to decouple your components. The sender of the event doesn't need to know anything about the receivers, and vice versa.
I just discovered UnityEvent tonight, and I feel it plugs a major gap in the whole component architecture. I wrote a forum thread about it here, with some examples.
Your answer
Follow this Question
Related Questions
Subscribers of Delegates? 2 Answers
How to add a persistent method with a single argument to a UnityEvent? 1 Answer
Adding UnityAction to UnityEvent from code 1 Answer
Help filtering objects using delegates, passing methods to methods for delegate instancing 1 Answer
Question about unsubscribing eventhandlers OnDisable and OnEnable 2 Answers