void Awake() { if (myInstance != null) DestroyImmediate(gameObject); else myInstance = this; RenameToType(); DontDestroyOnLoad(gameObject); }
void OnDestroy() { myInstance = null; }