Skip to content

Oculus multiplayer showcase demonstrating basic multiplayer functionality in Unity. Including: Oculus Social APIs, Oculus Platform authentication, Photon Realtime, and Photon Voice with Oculus Spatializer. The Oculus SDK and other supporting material is subject to the Oculus proprietary license.

License

Notifications You must be signed in to change notification settings

oculus-samples/Unity-SharedSpaces

Showcase Banner

SharedSpaces

SharedSpaces, developed by the VR Developer Tools team, showcases how to quickly gather people in VR using Oculus Social Platform APIs. This version is built for the Unity engine, utilizing Photon Realtime as the transport layer and Unity Netcode for GameObjects. There is also a version for the Unreal Engine.

This codebase serves as both a reference and a template for multiplayer VR games.

Project Description

SharedSpaces networking consists of three layers. The Oculus layer provides presence information to find and connect with friends. The Photon layer handles message transport between players. The Netcode for GameObjects layer manages game object replication.

This overview explores each layer and demonstrates how they integrate to create a simple multiplayer application, allowing people to connect and play without a dedicated server.

How to Run the Project in Unity

First, ensure Git LFS is installed by running:

git lfs install

Next, clone this repository using the "Code" button above or this command:

git clone https://github.com/oculus-samples/Unity-SharedSpaces.git

To run the showcase, open the project folder in Unity 6000.0.59f2 or newer. Load the Assets/SharedSpaces/Scenes/Startup scene.

Upon loading the scene, you may see this pop-up:

Click "Import TMP Essentials" to import the necessary TextMesh Pro assets.

Setting up Photon

To get the sample working, configure the NetDriver with your Photon account. Their basic plan is free.

  • Visit photonengine.com and create an account.
  • From your Photon dashboard, click "Create A New App."
  • Fill out the form, setting the type to "Photon Realtime," then click Create.

Your new app will appear on your Photon dashboard. Click the App ID to reveal the full string and copy it.

Paste your App ID in Assets/Photon/Resources/PhotonAppSettings.

The Photon Realtime transport should now work. Verify network traffic on your Photon account dashboard.

Dependencies

Where are the Meta and Photon packages?

The Meta packages are referenced in the Packages/manifest.json file; update them using the Package Manager within the Unity Editor.

To keep the project organized, the Photon Voice 2 package is stored in the Packages folder. To update, import their updated Asset Store packages, then copy them into their respective Packages folders.

The Photon Voice 2 package is released under the License Agreement for Exit Games Photon.

The Photon Realtime package is referenced in Packages/manifest.json as com.mlapi.contrib.transport.photon-realtime.

Getting the Code

First, ensure Git LFS is installed by running:

git lfs install

Then, clone this repository using the "Code" button above or this command:

git clone https://github.com/oculus-samples/Unity-SharedSpaces.git

Documentation

License

The majority of Shared Spaces is licensed under MIT LICENSE, however files from Photon SDK are licensed under their respective licensing terms.

Contribution

See the CONTRIBUTING file for how to help out.

About

Oculus multiplayer showcase demonstrating basic multiplayer functionality in Unity. Including: Oculus Social APIs, Oculus Platform authentication, Photon Realtime, and Photon Voice with Oculus Spatializer. The Oculus SDK and other supporting material is subject to the Oculus proprietary license.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 9

Languages