Unity Trackables
Updated: May 29, 2025
- Explain what a trackable is and how it differs from static scene anchors.
- Grant the Spatial Data permission required for all tracking APIs.
- UseTrackerConfiguration static support checks (e.g.
OVRAnchor.TrackerConfiguration.KeyboardTrackingSupported) before configuring. - Configure an OVRAnchor.Tracker via ConfigureAsync and handle unsupported or partially satisfied configurations.
- Fetch trackables with FetchTrackablesAsync and handle the returned list.
- Implement continuous polling (e.g. looping with a delay) to automatically refresh your trackables list.
A
trackable is a physical object (e.g. a keyboard) that can be detected and tracked at runtime, unlike
scene anchors, which are captured during Space Setup. You can use the low-level Core SDK (
OVRAnchor.Tracker) for full control or the high-level MRUK APIs (
MRUKTrackable) for event-driven simplicity.
In order for your app to be able to detect trackables, you must configure an anchor tracker. You can then periodically query for trackables. This topic describes the low-level API available in the Meta XR Core SDK. Use this if you want full control.
Trackables in MRUK
For most use cases, consider using the MRUK package. It provides a simple event-driven API for using trackables.
Use the low-level Meta XR Core SDK when you need full control over detection. Create an OVRAnchor.Tracker, configure it for specific types, and poll with FetchTrackablesAsync.
To track a particular type of trackable, create and configure an OVRAnchor.Tracker:
OVRAnchor.Tracker _tracker;
async void Start()
{
// Create a tracker
_tracker = new OVRAnchor.Tracker();
// Configure it to detect keyboards
var result = await _tracker.ConfigureAsync(new OVRAnchor.TrackerConfiguration
{
KeyboardTrackingEnabled = true,
});
if (result.Success)
{
// Keyboard tracking enabled!
}
}
If the requested configuration is not supported, or if the configuration cannot be fully satisfied at the current time, then
ConfigureAsync will return a result indicating an error. Additionally, the
Configuration property represents the current state of the tracker. If
requestedConfiguration != tracker.Configuration, some aspect of the requested configuration could not be satisfied.
The TrackerConfiguration class has static methods to check for feature support prior to configuring the tracker. For example, to check whether keyboard tracking is supported, use OVRAnchor.TrackerConfiguration.KeyboardTrackingSupported.
List<OVRAnchor> _anchors = new List<OVRAnchor>;();
async void UpdateTrackables()
{
var result = await _tracker.FetchTrackablesAsync(_anchors);
if (result.Success)
{
foreach (var anchor in _anchors)
{
Debug.Log($"Anchor {anchor} is a trackable of type {anchor.GetTrackableType()}");
}
}
}
The list updates as objects enter or leave view. Call this method periodically to refresh your list of trackables.
To automatically refresh without manual calls:
async void PollLoop()
{
while (enabled)
{
await UpdateTrackables();
await Task.Delay(TimeSpan.FromSeconds(1));
}
}
MRUK Keyboard Tracker Sample
Demonstrates how to build a keyboard tracker using MRUKTrackables and trackable events. Includes the Bounded3DVisualizer that fits prefabs, such as a Passthrough Overlay, to a detected keyboard’s 3D bounds.
View sample