how do i subscribe and unsubscribe to a static event in a non mono script? in mono scripts i know how we use OnEnable() and OnDisable(). as well as Start() and OnDestroy()
Common c# classes do not have any life management methods, except for constructor and destructor (which you should not use). And also IDisposable interface. That means you can do subscribe/unsubscribe in whatever place it’s appropriate to you.
So the main problem - is to understand why and when do you need to sub/unsub at all. If you non-behavior object (A) connected to some behavior object (B), you can use B’s OnEnable/OnDisable to propagate sub/unsub to A.
If you need to subscribe at object creation and unsubscribe at object disposal, you can do sub in constructor, and unsub at Dispose method from IDisposable interface. This method is called either manually, when you don’t need an object any more, or with a using statement.
Let me please digest/investigate on the way you’re pointing, and I’ll do my best to test it. I’ve made a complete search and there’s no websocketbehavior class at all in the asset I’ve bought from the asset store.
By the way, thanks for your patience and helping others learn!