void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad (this); } else { DestroyImmediate (gameObject);//destroy this gameobject if it's already exist } }
void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(this); } else { DestroyImmediate(gameObject); //destroy this gameobject if it's already exist } }