Valves SteamVR plugin makes getting started with VR in Unity quite a bit easier. The [CameraRig] prefab is a perfect starting point for most projects, and the controller and input tracking is amazing. But there’s quite a bit more to the package than just that. The SteamVR_Skybox is one of the features in the SteamVR plugin that you should definitely know about and use.
What’s the SteamVR_Skybox do?
The SteamVR Skybox component will allow you to change what a player in the HMD sees when your game drops frames or is is ‘not responding’.
Of course removing frame drops is the best solution, but sometimes you have cases where that’s just not an option.
In many games the most common time this happens is during scene loading. Even using asynchronous methods to load your scene won’t resolve it for every case.
How do I use the SteamVR Skybox?
What I’ll usually do is create a child under the [CameraRig] and name it SteamVRSkybox.
I set the Y position of it to 1.5 and leave the X & Z alone.
This is to simulate a player of about 1.5 meters in height
Then I’ll add the the SteamVR_Skybox component to it and click “Take Snapshot”
What’s this do?
With this component in place, when the game loses a frame and would go back to the loading area, it instead shows what was visible when I took the snapshot.
Sometimes this is enough and the game will just work, but other times you may have a special ‘loading area’ or some intermission setup that you use.
In that case, just place your SteamVRSkybox in the proper place for your snapshot instead of under the CameraRig.
While this is a great solution for most cases, depending on your implementation, you may see some less than perfect stuff.
First is that the skybox only shows what’s visible when you take the snapshot, so any gameobjects you’ve spawned at runtime won’t be there… so if the frame drops are during gameplay, while it’s a tiny bit better, it will still feel weird.
And when you use it to load levels, I recommend you put the player into a loading area ideally. This would be some room where stuff doesn’t change at runtime and your snapshot can match up correctly.
Also because this is part of the SteamVR plugin, this method won’t work for games targetting the Oculus SDKs. For oculus, there’s another route you can follow that I’ll share some time in the future.
The SteamVR Skybox is only a tiny part of the awesome SteamVR package. It’s easy to setup in just a couple minutes and on it’s own can make your game or experience feel a little bit more polished. Again it’s not a fix all for bad performance, that should be addressed on it’s own, but it is a useful component and worth trying out.