A small test project showing how to sync VR CameraRig objects using Photon's PUN and VRTK.
It also includes an example on how to configure VRTK's SDK Manager at runtime:
This project uses both submodules and symlinks. You can't just download the .zip
GitHub provides because it won't include the submodules. To clone it properly:
-
Download and install Git for Windows. Make sure to install Git Bash when asked in the installer and tick the checkbox for Enable symbolic links.
-
Run Git Bash as administrator. Administrator rights are needed to set up the symlinks.
-
cd
into the folder in which you want to clone the project into, e.g.:cd "C:\Users\bddckr\Desktop"
-
Run the following command to clone the repo into a new folder named VRTK-PUN-NetworkTest:
git clone --recursive -c core.symlinks=true "https://github.com/bddckr/VRTK-PUN-NetworkTest.git" \ && cd "VRTK-PUN-NetworkTest/" \ && rm -rf "Assets/Libraries/VRTK" "Assets/Libraries/SteamVR" \ && git reset --hard HEAD \ && cd ..
This will clone the project, set up the submodules and set up the symlinks.
To be able to use this example project you'll have to set up Photon by specifying the AppId:
- Open the project in Unity.
- In the menu bar click on
Window > Photon Unity Networking > Highlight Server Settings
. - In the
Inspector
window change theAppId
field to your own one you got from Photon. - Open the scene
TestScene
found in theScenes
folder in theProject
window. - Hit Play!
To test multiplayer locally without another computer you can create a standalone build:
- Either click on
File > Build & Run
or:- In the menu bar click on
File > Build Settings...
. - Click the
Build And Run
button, choose a destination folder and name your executable.
- In the menu bar click on
- Run the build executable.
- Hit Play in the Editor!
This means you now have two copies of the game running at the same time, one standalone and one in the Editor.
This project was created with Unity 5.4.4f1 but should work in all the above versions (including the latest beta of 5.6.0), too. Make sure to allow Unity to upgrade the project when you open it.