// Use this for initialization void Start() { if (Instance != null) { GameObject.Destroy(gameObject); } else { GameObject.DontDestroyOnLoad(gameObject); Instance = this; } }
private void Awake() { //Check if only one in scene if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else { //already one in scene Destroy(gameObject); } }
void Awake() { if (instance == null) { DontDestroyOnLoad(gameObject); instance = this; } else if (instance != null) { Destroy(gameObject); } if (player == null) { player = GameObject.FindGameObjectWithTag("Player"); } if (stairArray.Length == 0) { stairArray = GameObject.FindGameObjectsWithTag("Stair"); } }
void Awake() { Instance = this; }