private void Awake() { DontDestroyOnLoader other = FindObjectOfType <DontDestroyOnLoader>(); if (other.gameObject != gameObject) { Destroy(other.gameObject); } }
void Start() { DontDestroyOnLoad(gameObject); if (isSingleton) { if (thisSingleObject == null) { thisSingleObject = this; } else if (thisSingleObject != this) { Destroy(this); } } }