VR SDK integration abstraction


Currently we support the Oculus SDK and OpenVR via the SteamVR SDK. The SteamVR plugin can be downloaded via the Unity Asset Store and the Oculus SDK can be downloaded from the Oculus developer website. Both are linked to with "Install" buttons if you go to the inspector of the NVRPlayer.


The meat of these two abstractions are inherited from two files: NVRIntegration and NVRInputDevice.

NVRIntegration is called when NVRPlayer gets initialized. It does initial setup, adding scripts to setup the tracking space, setting up camera rigs, and setting other SDK-specific initialization variables.

NVRInputDevice holds all the input device specific details. Render model and collider setup for each device, querying button status, triggering vibrations, that sort of thing.


NVRIntegration.Initialize gets called at NVRPlayer.Awake. NVRInputDevice.Initialize gets called right before the integration Initialize. It is called from NVRHand.PreInitialize. After that, NVRInputDevice is only called through NVRHand. This is to keep a layer between input device implementation and NVR, so most SDKs should fit in cleanly.


Base classes are in the main NewtonVR folder:

  • NewtonVR/NVRIntegration.cs
  • NewtonVR/NVRInputDevice.cs

Inherited classes can be found in their own folders inside the NewtonVR folder:

  • NewtonVR/Oculus/NVROculusIntegration.cs
  • NewtonVR/Oculus/NVROculusInputDevice.cs
  • NewtonVR/SteamVR/NVRSteamVRIntegration.cs
  • NewtonVR/SteamVR/NVRSteamVRInputDevice.cs


We chose this route instead of using #if defines to define out the entire class for clarity in reading the code. NewtonVR is meant as much of a complete interaction package as it is a starting point for whatever you want to do in VR with tracked controllers. Throwing #if defines everywhere is a fast way to make your code completely unreadable.