Tutorial: Steam VR in Unity with Photon Pun 2


Paul Molnar, March 2022

Why Build an Application in Unity for Steam VR?

Steam VR is a great tool to build games for because it is a universal hub for almost every headset out on the market. If you are concerned your game/application may have issues on different headsets then building for Steam VR is the choice for you. Steam VR keeps an updated package on the Unity Asset Store and will automatically update your Unity project as soon as you import it. It has lots of different models and prefabs inside of the package which allow you to immediately start customizing your project such as choosing for your character to have crazy alien hands. Another great reason to develop for Steam VR is that there is lots of info out there about how to get started as it is one of the largest hubs for virtual reality on the internet. To learn more about Steam VR and why you should use it visit the Steam VR website at: Steam VR About Page.


**NOTE**: This is an intermediate tutorial for people with experience building projects in Unity. If you have no experience with building Unity Projects I recommend following along with the YouTube videos linked at the bottom of this page as it will clarify some steps


Project Set Up:

Note that this tutorial is accurate as of 2022. For years after 2022, scripts may need to be updated and packages may have changed. First open up a new 3D project in Unity with the latest version. There are known problems with some of the packages involved in this tutorial in earlier versions so it is recommended to use versions 2020 and after. Next you will have to head into the Unity Asset Store and install the following packages:


Part 1: Creating Steam VR character with movement

By now you should have a project with both of the above packages installed and the settings updated to be a Steam VR project as well as having a Photon Pun App connected to your project. Next we will add a Steam VR player into the program and give it simple movement using the joystick.


Part 2: Multiplayer using Photon Pun

This section of the tutorial is easy to mess up so I would recommend following along with the second YouTube video linked at the bottom. It has good visuals and explanations that complement this written tutorial well.


Building the application for deployment to other computers:


Scripts (dated March 2022):

Here is a link to a google drive folder containing the 4 scripts that you need for this tutorial: Tutorial Scripts. Go ahead and download them and add them to your Unity project as C# Scripts. If you have a Mac it may ask you to change the line endings which you should accept in order to suppress the warnings.


Helpful YouTube videos by Valem:

Valem is a YouTuber who has created lots of good content on creating VR games with Unity. Not every part of these videos was added in this tutorial. For instance the first part of "How to Make a VR Multiplayer Game - PART 1" is about developing for Oculus which we are not doing so it was skipped and replaced with the Steam VR set up.

Part 1: STEAM VR - The Ultimate VR developer guide - PART 1 

Part 2: How to Make a VR Multiplayer Game - PART 1 

Part 2 extended: How to Make a VR Multiplayer Game - PART 2 

He has tutorials for developing for Oculus, Steam VR, and other platforms. He also does game reviews, tutorials on building different genres of games such as FPS or horror, and how to develop under certain constraints such as having no headset. If you have a basic question about VR and would like a tutorial, Valem's channel likely has an answer and a video for you to watch on the subject.


Conclusion

If you made it all of the way through this tutorial unscathed, congratulations! Networking is tricky and can lead to lots of bugs. If you are looking down here for help and haven't watched the YouTube videos yet make sure to go do that. If you are looking to add more features and don't know where to start there is a manual at this link, Photon Pun Manual, which has lots of good info on how to allow users to interact with the same objects and other fun things which could be beneficial to your project.