Пример #1
0
        // Sets up singleton instance. Will remain if one does not already exist in scene
		protected override void Init()
		{
			if(instance == null)
			{
				DontDestroyOnLoad(gameObject);
				instance = this;
			}
			else if (instance != this)
			{
				Destroy(gameObject);
			}
		}
Пример #2
0
 protected override void Init()
 {
     if(_instance == null)
     {
         DontDestroyOnLoad(this.gameObject);
         _instance = this;
     }
     else if (_instance != this)
     {
         Debug.Log("Too many load managers");
         Destroy(this.gameObject);
     }
 }