Пример #1
0
    // Update is called once per frame
    void Update()
    {
        string sc = SceneManager.GetActiveScene().name;

        if (sc == "AMainHub" || sc == "ENDING")
        {
            instance = null;
            Destroy(this.gameObject);
        }
    }
Пример #2
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(this.gameObject);
     }
 }