Exemplo n.º 1
0
	void Awake()
	{
		if (Instance != null && Instance != this)
		{
			Destroy(gameObject);
		}
		Instance = this;
		// Furthermore we make sure that we don't destroy between scenes (this is optional)
		DontDestroyOnLoad(gameObject);
	}
Exemplo n.º 2
0
 void Awake()
 {
     if (Instance != null && Instance != this)
     {
         Destroy(gameObject);
     }
     Instance = this;
     // Furthermore we make sure that we don't destroy between scenes (this is optional)
     DontDestroyOnLoad(gameObject);
 }