The gentleman @Kurt-Dekker gave me a solution for a singleton usage/good practice here
This is a neat and clean solution, but sometimes I got an error in the editor when I stop playmode:
Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)
From what I understand it is due to how I manage (or how I DO NOT manage should I say) unloads.
private static GlobalEvents _Instance;
public static GlobalEvents Instance
{
get
{
if (!_Instance)
{
_Instance = new GameObject().AddComponent<GlobalEvents>();
_Instance.name = _Instance.GetType().ToString();
DontDestroyOnLoad(_Instance.gameObject);
}
return _Instance;
}
}
I did not do anything about that because so far the editor was handling himself well. But lately (from nowhere) it start showing me this error on one of my singleton and sometime all at once (it’s not concistent)
Should I fix it or is it not important (a.k.a just an editor problem)
Thanks