How to Make a VR Game in Unity – Detailed Guide with FAQs & More

Do you want to make a VR game in Unity?

Let’s find out how.

How to Make a VR Game in Unity?

To enable VR support for your game builds and Unity projects, go to the Player Settings (Edit > Project Settings > Player) and check the box next to “Enable VR”.

To enable VR support, select Other Settings and check the “Virtual Reality Supported” box. Then set this option for each build configuration.

Unity VR

Unity VR allows developers to create applications targeting virtual reality devices directly from within Unity, without using any external plugins. It offers a basic API and feature set with support for various devices.

It was designed to be compatible with future devices and software. As VR grows, so too will its API surface.

Using the native VR support in unity gives you access to:

  • Each version of each VR device has its own set of pros and cons.
  • An API interface for interacting with different VR devices
  • A clean workspace with no external plugins installed for each device
  • The ability to include/switch between different devices in your application
  • Higher performance (lower-level Unity engine optimizations are possible for native devices).

What Happens When VR Is Enabled?

When VR is enabled for use in Unity, some automatic changes occur.

Automatic Rendering to a Head-Mounted Display

All cameras in your project can be rendered directly to the HMD. View and projection matrices are automatically adjusted so that they take into consideration any movement of the camera, positional tracking, and the FOV of the camera.

You can use the StereoTargetEye property to prevent rendering from the HMD. Or, you can use the TargetTexture property to render to a render target instead.

StereoTargetEye Property

You can use the stereoTargetEye property to specify which eye to display to the headset. This can be used for special effects such as displaying a rifle scope or creating stereoscopic video.

To achieve this, set up two layers for each camera. One targets the left side of the face, and the other targets the right side of the face. Tweak what goes into each camera using masking.

Automatic Head-Tracked Input

If your device is head-worn, then the appropriate FOV will be automatically applied to the screen.

You can manually set the FOV to a specific value, but you will not be able to set the Camera’s transform values directly.

Head tracking and positional tracking are automatically applied so that the position and orientation most closely match the user’s position and orientation before the frame is rendered.

Understanding The Camera

You can override the camera transform by attaching it as a child of an object. If you want to change its position or rotation, attach it as a parent of another game object.

This means that any transforms applied to the Camera object will be automatically applied to the camera itself. It also works for changing the position of the camera by applying transforms to its parents (the scene).

Imagine the camera’s location and orientation as where the person is looking when they’re not moving.

There are differences between sitting and standing VR experiences.

  • If your device supports an immersive experience, the camera‘s initial position will be at the center of the user’s play area.
  • You can use the seated experience to reset the camera to its neutral position by pressing the button on the controller.

For every VR application that renders to the device, the device automatically overrides its own default FOV setting with the one set by the developer in their VR SDK.

You can change this field of vision value through the script at run time to specify a different field of vision for your application.

  • You can change the camera’s field of view by using Camera.setFieldOfView()

Editor Mode

You can use Unity Editor mode to play your game directly on your device if your VR device supports it.

If you have stereoTargetEyes set to either left or both, then the left eye is rendered to GameView; otherwise, the game renders the second eye (the one not currently selected).

  • There is no automatic way to compare the left and right sides of your eyes.
  • To compare the game views from both eyes, first open two separate camera views, then set one to each eye. Then, set the viewports for each camera so they appear next to each other.
  • You might notice some performance issues when using the Unity Editor. To minimize these issues, maximize the game view by clicking the green arrow icon at the top right corner of the screen.
  • The Unity Profiler can help you understand how your game performs when run outside of the editor. However, the profiler itself also has overhead.

To evaluate your progress, you should first set up a build for your target platform and then run it directly.

When running a non-development version of your game, you’ll get the best results. However, if you’re developing your game, you can use the Unity Profiler to profile your code.

How to Make a VR Game in Unity?

How to Make a VR Game in Unity?

Built Applications: Choosing a Startup Device

Your app initializes and enables the device in the same order as its Player Settings. If a device isn’t listed there, it won’t be available in the final build of your app.

You can use an optional command line parameter to specify which USB port to connect to when starting up the application. However, if you don’t include any devices in the configuration file before building the application, then the default USB port will be used.

To start up a specific device, use the following command line argument: -vr mode DEVICE TYPE

Where DEVICE-TYPE is one of the device types listed in the supported VR devices list (e.g., Oculus Rift).

Hardware and Software Recommendations for VR Development in Unity


To achieve a high-quality VR experience, you need to ensure that the framerate of the headset matches the refresh rates of the displays used in the HMDs.

If the frame rates drop below the HMD‘s display resolution, it is particularly noticeable, and often causes nausea for the player.

Refresh rates for VR devices:

VR DeviceRefresh Rate
Gear VR60hz
Oculus CV190hz


  • Windows: Windows 7, 8, 8.1, and Windows 10 are all compatible.
  • Android: Android OS Lollipop 5.1 or higher.
  • OS X: OSX 10.9+ with the Oculus runtime. However, Oculus has paused development for OS X, so use Windows for native VR functionality in Unity.
  • Graphics Cards: Make sure your graphics driver is updated. Older graphics cards may no longer be compatible with newer operating systems.
  • Oculus Runtime: Runtime 0.8 or higher.


In conclusion, we hope this article helped you understand how to make a VR game in Unity. We would love to hear about your experiences making VR games in Unity!

Let us know in the comments below.


  • Victor Marquez

    Victor is the Editor in Chief at Techtyche. He tests the performance and quality of new VR boxes, headsets, pedals, etc. He got promoted to the Senior Game Tester position in 2021. His past experience makes him very qualified to review gadgets, speakers, VR, games, Xbox, laptops, and more. Feel free to check out his posts.

Related Articles

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors