The Unity XRAn umbrella term encompassing Virtual Reality (VR), Augmented Reality (AR) and Mixed Reality (MR) applications. Devices supporting these forms of interactive applications can be referred to as XR devices. More info
See in Glossary SDK is aimed at specialist users who want to develop their own XR providers that work with Unity. To download XR SDK, you must sign up for access on this page.
The XR SDK package allows multiple backends (called “providers”) to implement a single engine feature (called a “subsystem”) in Unity. User applications can select and activate providers at runtime.
A single subsystem consists of:
A subsystem descriptor is metadata about a subsystem which can be inspected before loading or initializing a subsystem. This comes from a manifest file and is accessed via a C# interface. A Create
method activates the subsystem and provides an instance of it to the user’s scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info
See in Glossary.
For more information, see the Runtime discovery and activation of subsystems page.
When Create
is called on a subsystem descriptor, this creates a subsystem instance. Scripting code interacts with these instances in order to communicate with the subsystem. The subsystem itself has its own lifecycle: it can be started, stopped, and shut down.
A provider is the native implementation of a subsystem. One subsystem can have multiple providers. Some subsystems can allow multiple providers to be active at a time, but others might be mutually exclusive.
Providers conform to the Unity native plug-in interface, with some additional lifecycle support built on top. The entry point is the UnityPluginLoad
method. From there, the provider must register with all subsystems it intends to implement.
extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API
UnityPluginLoad(IUnityInterfaces* unityInterfaces)
{
s_XrDisplay = unityInterfaces->Get<IUnityXRDisplayInterface>();
UnityLifecycleProvider displayLifecycleHandler =
{
NULL, // This can be any object you want to be passed as userData to the following functions
&Lifecycle_Initialize,
&Lifecycle_Start,
&Lifecycle_Stop,
&Lifecycle_Shutdown
};
s_XrDisplay->RegisterLifecycleProvider("Provider Plugin Name", "Display0", &displayLifecycleHandler);
// Register with other subsystems...
}
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.