Is there an advantage to using Unity Events vs. C# events?

As a veteran C# programmer, I find Unity Events a bit backward to my usual thinking and prefer the more sensible, to me, way of thinking that a class has an event and up to any other object to subscribe to that event. I realize that in the Unity Event case, ‘knowledge’ of the class & method to call on a Unity event isn’t in-code so technically isn’t creating a tight coupling but it feels a bit unclean to me.

Is there an advantage to Unity Events other than it’s a more in-editor way of making callbacks so may be preferred by some folks?

I found a great discussion in a later video that helped me think about this differently:
Alternative using Action insead of unityevent - Unity Courses / Talk -

1 Like

UnityEvents definitely have their place. You can still subscribe to them from code, but with the added benefit of being able to hook things up in the inspector. This can come in very handy when working in a team environment. It can also help to make the class more reusable in the future.

Yes, I hadn’t considered the team environment scenario until reading further. And once I saw your mention in the above post of the ability to programmatically work with Unity Events I was sold. :slight_smile:

Privacy & Terms