I have been messing around with UnityEvents and really like them! I’ve been looking at a lot of different tutorials and noticed that there seems to be two ways to use them and I’m just curious if there’s a functional difference between the two that I should be aware of. I hope the terms I use make sense… I’m still wrapping my head around that as well.
Method 1 - Serialize at the top, then create variables with a type that matches the serialized definition followed by the name of the event.
[System.Serializable] public class CheckForWin : UnityEvent<int, int, int> { }
...
public UIScoreUpdate OnUpdateUIScore;
Method 2 - Serialize at the top, then create variables of type UnityEvent and include the parameters if present, followed by the name of the event.
[System.Serializable] public class CheckForWin : UnityEvent<int, int, int> { }
...
public UnityEvent<int, int, int> OnUpdateUIScore;
The second method looks a whole lot cleaner and is far more intuitive to me but I’m curious if I’m setting myself up for frustrations later on with that approach.