Search Unity

VR headset locks, and loading bar freezes on LoadSceneAsync

Discussion in 'AR/VR (XR) Discussion' started by JCNG, May 9, 2018.

  1. JCNG

    JCNG

    Joined:
    Sep 6, 2013
    Posts:
    41
    I've been trying to figure this out, and have googled it for a few hours, with no solution. I have a small scene that loads, and when the user is done with it, they hit a button to load the next scene which is fairly large. When the scene starts to load, the VR headset locks up, and the progress bar I created to show the loading doesn't work. I've tried this with both single and additive loading, but nothing seems to work.

    Does anyone have any idea why it may not be working?

    I'm using this available script: https://gist.github.com/Democide/beba5fd2603b268a8f72
     
  2. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    From a cursory glance it looks OK. Async loading stopping at 0.9 was the big gotcha. As one of the comments at the bottom mentions, you should use `yield return SceneManager.UnloadSceneAsync(oldScene);` rather than non-async. Sorry I don't have more time to investigate.

    Does it unlock eventually or just stays hung? (how long have you left it? Btw the Editor is much slower at this than the actual device, I've found.) I'd apply the debugger or logging to figure it out. (next step?)
    I assume you've tried the script without VR too?

    I wrote my own code for doing the same thing. I used a spinner but know it still hangs a bit during load. I concluded that's likely why things like the DayDream Requirements say "fade while loading" (since you can't see loss of tracking).
    I haven't released yet so still have potential to reduce my Awake code (which is apparently what's giving problems).

    HTH