Skip to main content

Building for PC in Unity

Once you have a project that you want to build, you can follow this tutorial. This guide assumes you've configured your project for OpenXR. It is applicable to most PC VR systems that support OpenXR, including the following systems:

  • Varjo Aero
  • Valve Index
  • Oculus Rift S
  • HP Reverb G2
  • HTC Vive (and derivatives)

You should use a different build process for other VR systems and/or projects that do not use OpenXR.

Building a PC VR Project in Unity

In Unity, go to File > Build Settings.

Verify that the platform is set to Windows, Mac, Linux.

In the lower part of the dialogue window, click on "Player Settings..."

In the window that opens, look in the left menu. Under "XR Plug-In Management" verify OpenXR is checked.

Underneath XR Plug-in Management there will be some items such as OpenXR, Project Validation, etc. Select OpenXR on the right. You will see a small window with Interaction Profiles. You may have already added the Oculus Touch Controller Profile.

Choose whichever controller is applicable to your targeted system. (You can add more than one profile to support multiple hardware systems)

  • Index Controllers: choose "Valve Index Controller Profile"
  • Rift S Controllers: choose "Oculus Touch Controller Profile"
  • HTC Vive Controllers: choose "HTC Vive Controller Profile"
  • HP Reverb G2 Controllers: choose Microsoft Motion Controller Profile"

Note: it is possible to use controllers from one manufacturer with a headset from another. For example, you might choose "Valve Index Controller Profile" if you are using the Valve Index controllers with any other compatible headset such as the Varjo Aero, HTC Vive, etc.

Go back to the Build Settings window, which should still be open (if not, open it again).

Verify that the scenes you want to build are shown in the "Scenes to Build" window. If no scenes appear, you can drag scene files from the Project window into this box.

In the "Build Settings" window, click the "Build" button in the lower right.

In the dialogue window that opens, navigate to a location where you want to build your scene. It is recommended to make a "Builds" folder within your Unity project, but this isn't necessary.

Click "Select Folder" and the project will build to that pointed directory.


To run your build, in your OS navigate to the folder where you built the project and double click the .exe file named for your project. 

You can build a project on a computer other than the one you plan to run it on. Just make sure you run your build on the appropriate hardware per your build settings.


Considerations

Under Project Settings/Player/Resolution and Presentation, consider different modes such as Fullscreen or Windowed. Also note at the very top the is a location where you can add a Default Icon as well as Company Name and Product Name


Optimizing Your Build For VR

Though the process above will result in a working build, there are some extra settings you can use to optimize your project for VR applications. These setting are all available in the "Project Settings" window on the left side.

  • Player > Other Settings > Color Space: Set this to "Linear" to better support the built-in color profiles of VR headsets
  • Quality > Rendering > Anti-Aliasing: Set this to "4X" to optimize edge smoothing for VR performance
  • Quality: At the top, choose "High" to set a collection of settings in a manner that optimizes performance for VR