UnitySingleton icon indicating copy to clipboard operation
UnitySingleton copied to clipboard

HasInstance boolean for unsubscribing from events in OnDisable/OnDestroy

Open my-dimons opened this issue 6 months ago • 0 comments

Fixes the issue brought up in #17

Changes

  • Added a HasInstance boolean in the MonoSingleton<T> and Singleton<T> scripts.
  • Updated the README.md with a "Common Issues" section which lists why this error happens, and how to fix it

I ran into this error when making my own game using this package and trying to unsubscribe from events. I tried the fix described in the response and it worked, but I saw there was no fix in the project for it. I would have to add it to every script I made if I didn't fix it, so here we are.

my-dimons avatar May 22 '26 21:05 my-dimons