Compiler Error: UnityEvent Implementation
JorisDrobka opened this issue · 4 comments
NetworkDiscovery.cs 44: Cannot create an instance of the abstract class or interface 'UnityEvent<NetworkDiscovery.DiscoveryInfo>
UnityEvent is abstract, custom unity events need to be implemented as their own type:
[System.Serializable]
public class NetworkDiscoverEvent : UnityEngine.Events.UnityEvent {}
public NetworkDiscoverEvent onReceivedServerResponse = new NetworkDiscoverEvent();
Which version of Unity you use ? The project is tested with 2020.3 and newer versions.
2019 LTS (2019.4.xx)
Huh that's weird, doc says Events must be overriden and cannot be an instance
https://docs.unity3d.com/ScriptReference/Events.UnityEvent_1.html
No idea why it works for @in0finite on 2020.3++ but it contradics the documentation
Yeah, definitely something is weird there, the class UnityEvent<T0>
is NOT abstract.
For me, there are no compiler errors and I can persist event callbacks in the scene.