Quantcast
Channel: Questions in topic: "loadlevelasync"
Viewing all articles
Browse latest Browse all 194

LoadLevelAsync multiple pending scenes?

$
0
0
I'm trying to create a system that loads the main menu and the next scene in the background. I want this because I don't want the user to wait a long time for the level to load after pressing "next level". Here is what I have so far: private AsyncOperation nextLevel; private AsyncOperation mainMenu; void Start () { nextLevel = Application.LoadLevelAsync (Application.loadedLevel + 1); nextLevel.allowSceneActivation = false; mainMenu = Application.LoadLevelAsync (0); mainMenu.allowSceneActivation = false; } public void goToNextLevel () { nextLevel.allowSceneActivation = true; } public void goToMainMenu () { mainMenu.allowSceneActivation = true; } As you can see, I define 2 AsyncOperations for 2 scenes. I then allow scene activation later in different functions. When I call `goToMainMenu()` nothing happens. How can I load multiple scenes in the background but not switch to them unless the user calls a function? `Application.LoadLevel("scene")` takes a long time for large scenes. I want to load the next scene in the background so that the switch can happen instantly. Imagine a simple pac-man game. Would you really want to wait a few seconds after each level?

Viewing all articles
Browse latest Browse all 194

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>