private void Awake() { Instance = this; DontDestroyOnLoad(this); //Will actually be destroyed when the main game scene is loaded again, but unfortunately this //object is created before the game scene loads, so we need to do this to prevent the game scene //load from destroying it StartCoroutine(WaitForComponentCreation()); }
private void OnDestroy() => Instance = null;