Forum Discussion
alexfs
9 years agoExplorer
Prevent dropping out of application if main thread stalls from loading
Hey there,
I asked this question in the Unity forums but didn't get any luck and this is an Oculus specific issue.
Here are the steps we take to transition levels:
On Oculus it seems that the main thread gets stalled during the loading process which causes a frame rate drop which forces a brief drop out of the application. So we fade down to black then it pops white and shows the sensors in front then goes back to black and fades back into the scene. Is there any way to get around this forced behaviour? I can see why the runtime does it to avoid users being in a low framerate app that might causes motion sickness but in this instance it actually makes the problem worse.
Note that we don't have the option to make the levels/assets loaded any smaller and this occurs even when loading a few small assets additively (as we use a similar technique to the loading routine to bring in additional assets).
Thank you
I asked this question in the Unity forums but didn't get any luck and this is an Oculus specific issue.
Here are the steps we take to transition levels:
- Fade down to black
- Unload previous scene if there was one (there is a persistent level though which keeps the camera etc.)
- Load the new scene
- Fade up from black
On Oculus it seems that the main thread gets stalled during the loading process which causes a frame rate drop which forces a brief drop out of the application. So we fade down to black then it pops white and shows the sensors in front then goes back to black and fades back into the scene. Is there any way to get around this forced behaviour? I can see why the runtime does it to avoid users being in a low framerate app that might causes motion sickness but in this instance it actually makes the problem worse.
Note that we don't have the option to make the levels/assets loaded any smaller and this occurs even when loading a few small assets additively (as we use a similar technique to the loading routine to bring in additional assets).
Thank you
8 Replies
Replies have been turned off for this discussion
- vrdavebOculus StaffIs this on Gear VR? There is a known issue there, where Unity re-allocates the eye buffers without notifying our SDK for a frame or two. We are refactoring eye buffer management to fix this moving forward. For now, you can avoid it by using Application.LoadLevelAdditive and then explicitly deleting assets from the previous scene.
- alexfsExplorerHey, this is on the Rift. It actually works fine on GearVR.
- vrdavebOculus StaffWhich Unity version? Does it occur with 5.4 or 5.5?
- alexfsExplorer5.5
- vrdavebOculus Staff> Unload previous scene if there was one (there is a persistent level though which keeps the camera etc.)
Are you sure you aren't deleting the OVRManager instance? If that happens, or if you change the MSAA level, lighting space, or render scale, Unity will reinitialize VR. I would recommend making one persistent, dedicated GameObject with OVRManager.cs attached to it instead of having one on each OVRCameraRig. Can you share output_log.txt from a run where the flash occurs? I'll try and reproduce it here. - vrdavebOculus StaffI can't reproduce this issue with the script code from your Unity Forum thread. I tried with a variety of projects, using OVRScreenFade to perform the fade-from-black. A minimal scene that reproduces the issue would be helpful for debugging on our end.
- alexfsExplorer
vrdaveb said:
> Unload previous scene if there was one (there is a persistent level though which keeps the camera etc.)
Are you sure you aren't deleting the OVRManager instance? If that happens, or if you change the MSAA level, lighting space, or render scale, Unity will reinitialize VR. I would recommend making one persistent, dedicated GameObject with OVRManager.cs attached to it instead of having one on each OVRCameraRig. Can you share output_log.txt from a run where the flash occurs? I'll try and reproduce it here.
Well that's the thing I don't have an OVRManager in the scene, I'm using OpenVR.
So does Oculus drop out of the app on low framerate or is that just an assumption I've made?
In that case It's seems likely that something we're doing is causing a reinitialize though I don't believe we have changed anything you have listed there. - alexfsExplorerSo in further profiling I found some audio code that was acting strangely and sometimes taking up to 200ms which stalled the main thread and caused a drop. Also found some particle code that looked simple of the surface but actually caused an iteration of the entire particle list.
Removed the offenders and we no longer get drop outs. Hopefully the issue won't come back!
Cheers
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 2 years ago
- 2 years agoAnonymous
- 2 years ago