Having two cameras in a Unity VR game development

less than 1 minute read

Sometimes it is necessary to have two cameras in a Virtual Reality (VR) multiplayer game development. One is connected to the VR-Camera rig and the other one is connected to the desktop main display. Unity provides an easy solution to this end.


1. Check player settings

“Virtual Reality Supported” option in the player settings must be checked. Player settings in Unity is accessible under the following menu:
“Edit -> Project settings -> Player”

2. Cameras settings

After adding a second camera (considered as the desktop camera) to your game scene, change its “Target Eye” property to “None (Main display)”. Also, it is necessary to choose a “Depth” greater than the VR camera rig depth.

image-left image-left


Conclusion

This article tried to configure two cameras inside a Unity game in order to have two different camera perspectives at the same time, a VR head-mounted device camera perspective and a second camera perspective on the user’s desktop.