In order for this project to be functional in editor and on device there is some initial setup that needs to be done.
In order to run the project and use the platform services we need to create an application on the Meta Quest Developer Center.
To run on device you will need a Quest application, and to run in editor you will need a Rift application. The following sections will describe the configuration required for the application to run.
To use the features from the Platform we need to request which kind of data is required for the application. This can be found in the Data Use Checkup section of the application.
And configure the required Data Usage:
- User Id: Avatars, Destinations, Multiplayer, Oculus Username, Friends Invites, User Invite Others
- User Profile: Avatars
- Avatars: Avatars
- Deep Linking: Destinations
- Friends: Multiplayer
- Blocked Users: Other - we use the Blocking API
- Invites: Multiplayer, Friends Invite, User Invite Others
This application uses Destination configuration to enable users to invite friends in the same arenas and launch the application together.
First we need to open the Destinations from the Platform Services:
Then we need to setup the different destinations.
First off we have the MainMenu destination, which is a destination unique to the user where no other player can join them. It is setup like this:
You will notice that the deeplink type is set to DISABLED, which prevents users from joining this destination together.
Then we have different Arenas for each region:
This is an example for the North American region. The deeplink type is set to ENABLE and we use the data of the deeplink to specify the Photon region to use. The format of the deeplink message is specific to our project. You can also note that the Group Launch capacity is set. As we have a maximum of 6 players in an Arena, the maximum is set to 6. (Note that the maximum value must be set to enable group launch.)
Here is a table for destinations settings:
Destination | API Name | Deeplink Message |
---|---|---|
Main Menu | MainMenu | N/A |
North America | Arena | {“Region”:”usw”} |
South America | ArenaSA | {“Region”:”sa”} |
Japan | ArenaJP | {“Region”:”jp”} |
Europe | ArenaEU | {“Region”:”eu”} |
Australia | ArenaAU | {“Region”:”au”} |
Asia | ArenaAsia | {“Region”:”asia”} |
We then need to the set the application ID in our project in Unity.
The identifier (App ID) can be found in the API section.
Then it needs to be placed in the Assets/Resources/OculusPlatformSettings.asset
To get the sample working, you will need to configure Photon with your own account and applications. The Photon base plan is free.
- Visit photonengine.com and create an account
- From your Photon dashboard, click “Create A New App”
- We will create 2 apps, "Realtime" and "Voice"
- First fill out the form making sure to set type to “Photon Realtime”. Then click Create.
- Second fill out the form making sure to set type to “Photon Voice”. Then click Create.
Your new app will now show on your Photon dashboard. Click the App ID to reveal the full string and copy the value for each app.
Open your unity project and paste your Realtime App ID in Assets/Photon/Resources/PhotonAppSettings.
Set the Voice App Id on the VoiceRecorder prefab:
In the case of our project we wanted players to be able to play in different regions with reduced latency, therefore we used the different regions that Photon provided. But in order to make the project simpler we limited the number of regions we would use. To do so we need to whitelist which regions are used by the application.
The Photon Realtime transport should now work. You can check the dashboard in your Photon account to verify there is network traffic.