Exemplo n.º 1
0
    void Start()
    {
        SingletonTest mySingleton = SingletonTest.GetInstance();

        mySingleton.DoStuff();

        SingletonMonoTest myMonoSingleton = SingletonMonoTest.GetInstance();
    }
Exemplo n.º 2
0
 public void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(this.gameObject);
     }
 }