Proper implementation of Event Handlers

I What is the proper way to add event handlers in non-mono derived classes?
I became so used to onEnable + onDisable- and didn’t understand why it wasn’t firing.
Just wondering if there is a “right” way to add the handlers to avoid GC conflicts and poor style.
Thanks

Write a MonoBehaviour with the appropriate functions that calls your non MonoBehaviour functions.

You also have a constructor available in place of start.

1 Like

Thanks.
I went the constructor route. Makes sense :slight_smile:
Is there a need to unsubscribe and if so where or when.
Thanks again

Sounds like you wanna look into delegating and the “Event” keyword. Delegates are normally used in C# to create events and you can by using these create some very great systems to handle events in any class.

to get started try here: Unity Connect