Esempio n. 1
0
    // Don't override in derived classes, override PostOnDestroy instead
    void OnDestroy()
    {
        // Only clear the instance if this object is the instance
        if (instance != null)
        {
            if (instance.Equals(this))
            {
                SingletonHelper <GameObjectType> .HandleOnDestroy(ref instance, ref blockInstanceFetch);

                PostOnDestroy();
            }
        }
        else
        {
            Debug.LogError("Destroying an object when the instance of the singleton is null, this should not happen (unless you change scripts at runtime in the editor)!\n Type is " + typeof(GameObjectType).ToString());
        }
    }