ValveSoftware / steamvr_unity_plugin

SteamVR Unity Plugin - Documentation at: https://valvesoftware.github.io/steamvr_unity_plugin/
BSD 3-Clause "New" or "Revised" License
1.02k stars 254 forks source link

SteamVR_LoadLevel implement alternative method/class to import data async #264

Closed applus-huggy closed 3 years ago

applus-huggy commented 5 years ago

SteamVR Unity Plugin v2.0.1 We have to implement an extension class but would definitely benefit the development community as a whole.

Problem Case:

We work with large photogrammetry data, importing gigabytes of data at runtime, this prevents us from using the unity scene system to import the data (until we've built a cached scene and checksums match). We're extending SteamVR_LoadLevel to allow async import of data using the UnityEngine.WWW and the UnityEngine.AssetBundle classes. This is so that a loading screen can be displayed and prevent the user experiencing sub 90fps in the HMD.

Potential Solution:

Possibly in the SteamVR_LoadLevel.LoadLevel coroutine if there was an addition to the control statement (line:332-337) for Internal Process vs Loading a Unity Scene to also check if a publicly accessible 'Completed' property is true, then continue. The SteamVR_LoadLevel.progress property will ideally also need a setter for suggesting the load progress.

Thanks for your time.

JashanChittesh commented 5 years ago

For our games Holodance and Beat the Rhythm, we have a fairly heavily refactored version of SteamVR_LoadLevel that also has some fixes (not sure if this was addressed meanwhile, but preloading all shaders can completely ruin the startup time, so it's much better to handle this with Shader Collections).

We use this to fade to the compositor and back for whatever "heavy lifting" we need to do, loading levels is just one case.

Our version has quite a few dependencies that hook into our own game code - but if there's interest, I could probably clean it up and put it into a pull request.