Set Up for Platform Development with Unreal Engine
Updated: Sep 13, 2024
The Unreal Engine (UE) Getting Started guide walks you through setting up your development environment and checking the user’s entitlement.
Using the Platform SDK is slightly different from using the SDK in other development environments. For example, you can invoke Platform features using various methods, such as Blueprints or native C++ APIs.
Create an app
Before you can integrate the Platform SDK, you’ll need to create an app in the developer dashboard if you haven’t already. See the Creating and Managing Apps page to create an app.
Configure your development environment
Review the Meta Quest onboarding for UE development in the Unreal Engine Guide. Once you’re comfortable using UE to develop Meta Quest apps, you can implement Meta Horizon platform features.
Note: Meta Horizon OS platform features are integrated directly into the Unreal Editor. To see what version of the platform the Unreal version you are using includes, see Version Compatibility. To use the latest version of the platform, you can Download it separately.
Install the Platform SDK plugin
Choose the method to install the Platform SDK depending on which version of Unreal Engine you are using.
Using Epic Launcher Version for Unreal Engine 5
Note: This only applies to UE5 for UE4. See Using the GitHub Fork of Unreal Engine below.
Download and install UE5 following the instructions on the Installing Unreal Engine page in the UE5 documentation.
Extract the .zip file contents to the following UE5 installation folder: \Engine\Plugins\Marketplace\MetaXRPlatform. For example: C:\Program Files\Epic Games\UE_5.3\Engine\Plugins\Marketplace\MetaXRPlatform.
Using the GitHub Fork for Unreal Engine 4
Install the GitHub Meta Fork of Unreal Engine, which includes the Platform SDK.
Enable the Platform SDK Plugin
In the editor, select Edit > Plugins > Online Platform > Meta XR Platform, and check Enabled. The editor prompts you to restart Unreal Editor.
Adjust your DefaultEngine.ini file to use Meta Quest (Create a DefaultEngine.ini under [ProjectDirectory]/Config/ if needed):
[OnlineSubsystemOculus]
bEnabled=true
OculusAppId=[app_id_here]
RiftAppId=[rift app id here]
OculusAppId is the unique App ID you’ve retrieved from the API page of the Meta Quest Developer Dashboard.
RiftAppId is the App ID if creating a Quest Link App. This ID is different from the OculusAppId.
If you enable the Meta XR Platform Plugin, your app will require access to the User ID and User Profile and will require the Data Use Checkup process as part of your submission to the Meta Horizon Store. For more information, see Complete a Data Use Checkup.
Configuring your app for local development
The configuration steps in this section allows developers to run local builds of the application during the development process. This process is required, otherwise local versions of the app will not pass the entitlement check that you’ll integrate below.
If some of your developers are not part of the application’s organization, and they need to run your application outside the normal install directory. Add the registry key AllowDevSideloaded as DWORD(1) to the registry folder at HKLM\SOFTWARE\Wow6432Node\Oculus\Oculus. This does not bypass having a valid entitlement, it just bypasses the directory check.
Once the steps above are completed, the entitlement check will succeed when running a local build of your application.
Using Meta XR Platform SDK
1. Creating a GameInstance
Your project likely already has a custom GameInstance designed to support your application. If there isn’t one, you must add one and ensure the project uses it. In the Maps & Modes part of the Project Settings, click the + sign to create a new Blueprint.
Create the new Game Instance class and assign it to the project in the Project Settings > Maps & Modes > Game Instance
Once completed, the empty Blueprint editor will appear.
2. Starting the system
You must enable the Meta XR Platform to process messages and generate events. You can only call the Platform Nodes once the subsystem is running.
Initializing the platform subsystem raises an event indicating whether the process succeeded or failed. To respond to this event, create a custom event named OvrPlatformSubsystemStarted in the GameInstance Blueprint and attach the execution pin to the nodes to handle the success or failure of the subsystem’s initialization. The custom event name must be exactly OvrPlatformSubsystemStarted and within the GameInstance Blueprint.
Create the custom OvrPlatformSubsystemStarted event.
Add the OvrPlatformReady variable.
3. Handling events
The message pump described above raises events that may interest you as your application runs. You should bind event handlers to each of the events you care about.
To respond to these events, create custom event nodes and connect them to bind event nodes. You must do this before starting the message pump.
Some of the events include:
Abuse Report Button Pressed
Application Lifecycle Launch Intent Changed
Asset File Download Update
Group presence invite sent, join intent received, leave intent received
Live Streaming status change
Net sync sessions and connection status changes
VOIP system state and microphone availability changes
4. Starting the message pump
Start the message pump to begin processing messages and generating events
Advanced: Asynchronous Platform Initialization
The default initialization path is one that blocks while the Platform SDK does it’s work. While we’re always trying to improve the initialization time, it can take a few seconds to complete. At the cost of some added complexity, you can choose to use the Platform SDK’s asynchronous start up path. This can help app launch time and development iteration time.
The flow is largely the same as the standard synchronous path described above. The differences are that the initialization won’t start until you start the message pump, and that your game instance subclass’s OvrPlatformSubsystemStarted custom event will not be called until after the initialization attempt completes (and thus it will also be after the message pump is started).
To opt into the asynchronous start up path, add a DoAsyncInit=true line to the [OnlineSubsystemOculus]DefaultEngine.ini block you used to enable the Platform SDK Plugin.
Check the entitlement
One of the first things you must do when a user launches your app is verify that they own a legitimate copy of your app.
See Entitlement Check for instructions on how to check the user’s entitlement.
Testing
Before you can test the Platform SDK features, you must upload a shipping build of your app to the developer center. You only need to do this once and may then test locally and make changes without re-uploading. See Upload Apps For Meta Quest.