Hello guys!
I spent a lot of time understanding this function and I did many examples with this function but I didn’t reach anything conciliatory so I hope someone can help me.
My question is about uploading scenes:
Suppose I have a generic singleton that has this method in it.
Why should it has this method in it? I tested it and if I load a single scene the onDestroy function is called and that’s correct but if i delete this functin the program still works very good.
protected virtual void OnDestroy()
{
Debug.Log("Destroyed");
if (instance == this)
{
instance = null;
}
}