r/Unity3D•
onijames

Are AsyncOperations executed by order? How do I use priority?

Question

In the game I'm developing currently, I have the following situation:

  • I have a large exploration scene and several small ones connected to it.

  • Monobehaviours in charge of their zone to transition between scenes.

  • Also a Game Control Game Object that is never destroyed and keeps record of AsyncOperation.

  • I have 7 scenes. The map layout goes something like this:

  • Scene 1 can go to: Scene 2, Scene 3, Scene 4, Scene 5, Scene 6 and Scene 7

  • All Scenes except Scene 3 can go back to Scene 1.

  • I preload the other scenes by using SceneManager.LoadSceneAsync with LoadSceneMode.Additive on their StartMethod (if it's already preloaded, Game Control takes care of it and delivers the corresponding AsyncOperation).

Once that starts I set allowSceneActivation to false to not load those scenes.

When I transition into another scene, it seems as if I can't load any other scene other than the next one in order.


Some images to help.

It goes like this:

Play button:

I appear in Scene 1.

Scenes 2-7 are pre-loaded (not loaded, they appear as is loading in the editor).

Scene 1 -> Scene 2: I set the allowSceneActivation from its AsyncOperation to true.

When Scene 2 fully loads, Scene 1 Unloads (SceneManager.LoadSceneAsync).

I try: Scene 2 -> Scene 1

But doesn't work. I've tried also Scene 2 -> Scenes 4-7 and not working.

The only one that seems to work is Scene 3, the next one in order.


Have I misunderstood what LoadSceneAsync & AsyncOperations must be used for?

Is there any way to do what I'm aiming to do?

Sorry for the long post.

Posted Jan 5, 2017, 10:57 PM UTC

12
Loading comments…