- Test DepthAPI
- Test Gsplat
- Test Colocation
- Shared Spatial Anchors
- Test Portal Logic
https://github.com/oculus-samples/Unity-DepthAPI.git?path=/Packages/com.meta.xr.depthapi.urp
https://github.com/keijiro/SplatVFX.git?path=/jp.keijiro.splat-vfx
This Sample demonstrates how to enable Local Multiplayer in Mixed Reality using Unity and Netcode for GameObjects
If you are using Oculus Core SDK v65+, the majority of this code has been ported over to Multiplayer Building Blocks which provides a simpler version of this sample that demonstrates how to enable Mixed Reality Local Multiplayer
More specifically the sample demonstrates the following
- Matchmaking - Finding Players to play with
- Player Connection - Players joining the same game to play in
- Colocation - Players can see the same object in the same position
- Unity Version: 2022.3.12f1
- Mac or Windows
Opening the project
- Install Unity Version 2022.3.12f1
Building the project
In order to colocate with Shared Spatial Anchors we are required to have entitlements. The following steps outline how get the entitlements
-
If you don't already have a keystore to build an APK, create a new keystore by following Unity's documentation
-
Set up your app id
a. Go to the Oculus Developer Website
b. In the "My Apps" Section, click on Create New App
c. Once you have created a new app, it will come with an App Id
d. Go to the App. Your URL should look like the followinghttps://developer.oculus.com/manage/applications/{APP ID}/
e. In Assets/Resources/OculusPlatformSettings.asset, add your App ID to theOculus RiftandMeta Quest/2/Pro -
Get Entitlements
a. Build an APK of the sample project
b. Upload the APK to the same app that was created in the Building the project section
c. Download the newly created app on to your headset that was done in the Building the project Section
d. If everything was successful, an anchor can be seen in the same spot in multiple headsets and nametags can be seen on top of the users head
NGOSampleFlowScene.unity is the Unity Scene that shows how to set up local multiplayer
NGOSampleFlowBootstrapper - Class that handles matchmaking and player connection
NGONetworkBootsrapper - Class that handles colocation
Enabling Local Multiplayer involves 3 major steps
- Matchmaking
- Player Connection
- Colocation
Below we will demonstrate each players perspective. Assume that Player 1 must finish the entire set up before Player 2 joins
Player 1's Perspective
When Player 1 boots up, they enter the matchmaking phase and find out there aren't any games going on. Player 1 then enters the player connection phase and hosts a game. After sucessfully hosting a game, Player 1 enters the colocation phase where they create and save a Shared Spatial Anchor. Then Player 1 aligns to the Shared Spatial Anchor.
Player 2's Perspective
When Player 2 boots up, they enter the matchmaking phase and find out Player 1 is already in a game. Player 2 then enters the player connection phase and joins Player 1's game. After sucessfully joining the game, Player 2 is now in the colocation phase where Player 2 tries to find any Shared Spatial Anchors that exist and asks Player 1 to share it. Player 1 will share the Anchor with Player 2 and tell Player 2 the Shared Spatial Anchor is now being shared. Player 2 will try to find/localize the Shared Spatial Anchor and align to it.
I got an error that had the tag [SharedSpatialAnchorsError] what does this mean?
This means that the Shared Spatial Anchors Service may be currently down. Please report the issue
In the logs my oculus id is 0 what does that mean?
Your app appears not to be entitled. Make sure the Building the project section has been completed. It is working correctly when in your headset, your app is shown in any section except for the Unknown Sources.
The networking layer I want to use for my Unity Multiplayer Mixed Reality App isn't supported what do I do?
The networking layer will most likely have its own APIs for handling Matchmaking and for Player Connection. As for Colocation, the Colocation Package provides interfaces like INetworkData and INetworkMessenger that need to be implemented in order to enable colocation regardless of the networking layer used. Refer to how we implement the Colocation Package in the Samples.
The majority of this sample is licensed under MIT LICENSE, however files from Text Mesh Pro, are licensed under their respective licensing terms.