Beispiel #1
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
    // Start is called before the first frame update
    void Start()
    {
        if (instance != null)
        {
            Destroy(this.gameObject);
        }
        else
        {
            instance = this;

            this.gameObject.SetActive(false);
        }
    }