Open
Description
Unity's built-in LoadScene doesn't work well for VR. Some non-VR games use it rather than bothering with the async or additive version of LoadScene
because it's a simple call. Unfortunately, in VR the sync nature means that rendering is blocked, FPS on the headset plummets to 0, and while the next scene is loading the user is kicked back to the dashboard. So implementing scene loading correctly is an important issue in VR.
The SteamVR Unity Plugin contains a SteamVR_LoadLevel
component and API that offers an alternative for use in SteamVR and appears to do an number of things:
- It creates an progress bar and loading screen display as OpenVR overlays and also renders them to the companion window shown on the desktop
- Allows you to specify a skybox/color to theme the SteamVR dashboard and whether to display the grid
- Automatically fades out to the dashboard and stops rendering
- Handles sync/async/additive loading itself
- Does GC, warms up shaders, fades back out of the dashboard
- And does all this in a coroutine you can easily call without needing to use Unity's poor
LoadSceneAsync
api directly.
VRTK could use its own VRTK_LoadScene
component to simplify scene loading in VR.
There are 2 ways that a VRTK_LoadScene
could work.
- It could be a platform wrapper script:
- If the current VR platform/SDK has its own LoadScene implementation such as
SteamVR_LoadLevel
implementing a loading screen, it could be used - If the current platform doesn't it could simply fall back to traditional (async) scene loading
- If possible, it could be a high-level async loading implementation:
- We could implement base components for handling a floating progress bar / loading screen
- All the LoadSceneAsync handling could be abstracted to a
VRTK_LoadScene.Begin
(function) orVRTK_LoadScene.Load
(coroutine). - Perhaps something like a fade-to-black blink could be used for the momentary transition between scenes