Beispiel #1
0
 private void Awake()
 {
     if (_instance == null)
     {
         _instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         if (this != _instance)
         {
             Destroy(this.gameObject);
         }
     }
 }
Beispiel #2
0
    public void initialization()
    {
        UIPersist       UIElement = GameObject.FindObjectOfType <UIPersist>();
        DefenderPersist defender  = GameObject.FindObjectOfType <DefenderPersist>();
        GameTime        gametime  = GameObject.FindObjectOfType <GameTime>();
        //  camerapersit camera = GameObject.FindObjectOfType<camerapersit>();
        AKSpawnerControl akspawnControl = GameObject.FindObjectOfType <AKSpawnerControl>();

        Destroy(UIElement.gameObject);
        Destroy(defender.gameObject);
        if (gametime)
        {
            Destroy(gametime.gameObject);
        }
        Destroy(akspawnControl.gameObject);
        // Destroy(camera.gameObject);
    }