// Update is called once per frame void Update() { string sc = SceneManager.GetActiveScene().name; if (sc == "AMainHub" || sc == "ENDING") { instance = null; Destroy(this.gameObject); } }
void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(this.gameObject); } else { Destroy(this.gameObject); } }