Basically I want to load 2 scenes, and then I want the player to be able to choose 1 of them to activate, using allowSceneActivation = true on one of the /AsyncOperation/, and I want to trash the other scene so I can load it at a later stage, or not load it all ever.
How do I do that?
I want something along those lines:
AsyncOperation async1;
AsyncOperation async2;
AsyncOperation playerChosenAsync;
void LoadSceneAsync(string sceneName1, string sceneName2){
AsyncOperation async1 = Application.LoadLevelAsync(sceneName1);
async1.allowSceneActivation = false;
AsyncOperation async2 = Application.LoadLevelAsync(sceneName2);
async2.allowSceneActivation = false;
}
void ActivateScene(AsyncOperation sceneToActivate){
sceneToActivate.allowSceneActivation = true;
}
void TrashScene(AsyncOperation sceneToTrash){
sceneToTrash.Trash(); // This method doesn't exist,
// but I want to unload/delete do something here,
// to release memory/CPU/whatevs.
}
IEnumerator Update() {
if(playerChosenSync == async1){
TrashScene(async2);
ActivateScene(async1);
playerChosenSync = null;
} else if(playerChosenSync == async2){
TrashScene(async1);
ActivateScene(async2);
playerChosenSync = null;
}
}