private void TransitionToScene(string scene) { if (isSwitching) { return; } spawnManager.PreviousScene = SceneManager.GetActiveScene().name; spawnManager.ClearCheckpoints(); isSwitching = true; StopAllCoroutines(); // can still switch when fading out, so stop any lingering coroutines StartCoroutine(TransitionRoutine(scene)); }