SteamVR 2.0
@ Brian Kim (3/14/2023)
Context
In 2019, SteamVR rolled out a major change in SteamVR 2.0 that altered how programs in Unity that use SteamVR handle inputs. This page is intended to explain what the changes are. Hopefully, future SteamVR developers using this wiki can apply the changes referenced here to the rest of the tutorial.
Installation
Total time: ~15 min
Installation should be the same as described in the Unity Installation Page and the SteamVR Installation Page on the Wiki. Both should lead to the latest versions, including SteamVR 2.0 and a compatible Unity installation.
NOTE: If you want to use an older version of SteamVR, which will be more directly compatible with the Wiki tutorial, you will not be able to use the default installations.
Conceptual
The main change from SteamVR to SteamVR 2.0 is that the new preference is to abstract out button presses for actions. This mainly means that "SteamVR_TrackedController" is no longer the best way for a script to receive instructions from a VR controller. Instead, actions are connected to specific buttons by creating Action Sets un Unity, which are bound to specific inputs from a controller using Open Binding UI, and a script is created drawing on an abstract class: "MonoBehavior".
Comparison
Unity3D Tutorial #4 uses the older SteamVR version, while Unity3D Tutorial #4.1 uses SteamVR 2.0. I have added bolded text for areas in #4.1 that indicate parts of the tutorial that have been altered for SteamVR 2.0.
Technical Changes and Limitations
The biggest difference in the older and new versions of SteamVR for developers is how the SteamVR software maps the inputs from a controller to the scripted actions. Previously, "SteamVR_TrackedController" object allowed was able to generalize buttons and pads being clicked or manipulated by the user.
With SteamVR 2.0, a developer instead has to create an appropriate action set. Then, there is a built-in binding UI with SteamVR that allows for the different action sets to be linked to specific controller actions, such as button pushes and pad movements.
The important distinction is that the new binding UI requires that there be a headset and controller set connected to the device that the SteamVR program is running on. If your machine meets SteamVR's requirements here, then that will not be a problem.
However, if your machine is not capable of running SteamVR and connecting to a headset, such as the Oculus Quest 2, then there is no way to develop a program for VR using SteamVR in Unity on your machine.
This is an important requirement! Make sure that your machine is capable of connecting with your headset through SteamVR. If you cannot, then you will not be able to develop on your machine and will need to find an alternative, such as using a different machine or developing with OpenXR.