public void UnLoadScene(string scene) { if (IsActiveScene(scene)) { SceneManager.UnloadSceneAsync(scene); } //notify about finish UnLoading ApplicationEvents.UnLoadingFinish(scene); }
public void UnLoadScenesExept(string scene) { int countLoaded = SceneManager.sceneCount; Scene[] loadedScenes = new Scene[countLoaded]; for (int i = 1; i < countLoaded; i++) { loadedScenes[i] = SceneManager.GetSceneAt(i); if (loadedScenes[i].name != scene) { SceneManager.UnloadSceneAsync(loadedScenes[i]); } } //notify about finish UnLoading ApplicationEvents.UnLoadingFinish(scene); }