-
Notifications
You must be signed in to change notification settings - Fork 3
Unity XR Setup
Unity XR support enables developers to build for VSDK without importing the large support libraries provided by Oculus, SteamVR, and others. This streamlines setup and makes cross-platform development much easier.
VSDK Unity only officially supports the UnityXR SDK for Unity versions 2019.1 or greater. Prior to v2019.1, Unity handled XR inputs as shoehorned additions to the standard input system, which was not optimal for multiple reasons. Post-2019, XR input is handled more gracefully and we felt more comfortable supporting the new approach long term.
If you want to use the UnityXR SDK with older versions of Unity, it is possible, but you are on your own for resolving issues (although if you want to contribute solutions to the repo, the community would appreciate it).
- Create an empty project in Unity 2019.1 or later
- Remove the Main Camera from the scene
- Import the VSDK package into Unity
- Drag the VRTK_SDKManager and VRTK_Scripts prefabs from the VIRTUOSO/Prefabs folder into the scene
- Create an empty game object under the VRTK_SDKManager prefab and name it 'Unity XR':
- Add a VRTK_SDKSetup script to the Unity XR object
- On the VRTK_SDKSetup, choose the appropriate system from the quick select drop down (i.e., any of the systems starting with Unity that use the correct platform and VR system)
- Select Simulator and No Hands for the Tracker and Hand SDK options
- Drag the UnityBase_CameraRig object into the scene as a child of the Unity XR object
- On the VRTK_SDKManager, click the 'Auto Populate' button to add Unity XR to the list of available SDKs
- On the VRTK_SDKManager object, uncheck 'Auto Manage VR Settings'
- Go to the Player Settings menu, check 'VR Supported' option under the XR Settings heading.
- Click the + sign and add the appropriate XR platform for your project (it should match the platform on the Unity XR SDK Setup object), and remove the 'None' option from the list
- Expand the VRTK_Scripts object and drag the LeftControllerScriptAlias and RightControllerScriptAlias into the corresponding script alias fields on the VRTK_SDKManager object
- Add a visual representation for the controller models (for testing purposes, you can create two spheres, scale them to 0.1 in each axis, remove the collider component from each, and place one a child of the LeftControllerScriptAlias and the other as a child of the RightControllerScriptAlias)
Be sure to test your Unity XR setup in play mode.
Note: we are not actively supporting pre-2019 UnityXR setups.
- Follow the steps outlined in the first section
- Go to the VSDK repo on GitHub and download the ProjectSettings/InputManager.asset file.
- Copy the Input Manager file to the matching folder in your project
This setup should now work. Note that haptics are not available with this setup, but input should still work.