Develop
Develop
Select your platform

Mixed Reality Utility Kit - World Lock Colocation

Updated: Mar 2, 2026

Learning Objectives

  • Understand how to colocate multiple headsets in the same physical room.
  • Set up MRUK with the required settings for colocation.
  • Implement the Host and Peer flows using a simple API call.

Overview

World Lock Colocation lets multiple users in the same physical environment see, interact with, and manipulate the same mixed reality content. Unlike space sharing, which shares detailed Scene data, World Lock Colocation only requires a single shared spatial anchor, with no need to scan your room
The SetCustomWorldLockAnchor API (available since MRUK v83) lets you override the default world lock anchor with your own shared spatial anchor. This is the key primitive for colocated multiplayer alignment—making all headsets in the same room agree on where virtual objects are.
Before continuing, it might be helpful to get familiar with Shared Spatial Anchors (SSA), and especially with the concept of group-based anchor sharing and loading, which Colocation is based on. For a step-by-step guide on how to use Spatial Anchors, SSA, as well as Space Sharing, see our MR Motif about Colocated Experiences.

How it works

One player (the Host) creates a shared spatial anchor and records its pose—that’s the “ground truth” for where the world origin should be. Every other Peer receives that anchor and pose, then calls SetCustomWorldLockAnchor to align their coordinate system to match the Host’s.
Once aligned, MRUK automatically compensates for tracking drift, keeping virtual objects in the same physical locations for everyone.
See the World Locking section in Manage Scene Data for more information on this feature.

Use cases

Competitive Gameplay
Competitive Gameplay
Compete in mini-golf, tag, or strategy games sharing the same MR playfield.
Collaboration
Collaboration
Co-create furniture layouts, sketches, or designs in a shared augmented space.
Media Watching
Media Watching
Enjoy spatialized video, multi-screen displays, or 3D audio together.
Training
Training
Practice hands-on drills or assembly tasks with synchronized 3D overlays.

Requirements

  • MRUK v83 or later
  • EnableWorldLock = true on the MRUK component
  • OVRCameraRig in the scene
  • A working Shared Spatial Anchors setup for creating and resolving anchors across devices
Warning
When EnableWorldLock is true, MRUK owns the trackingSpace transform. Use MRUK.TrackingSpaceOffset for any additional offset—don't modify trackingSpace directly.

API reference

public void SetCustomWorldLockAnchor(OVRSpatialAnchor anchor, Pose poseOffset)
ParameterTypeDescription
anchor
OVRSpatialAnchor
The shared anchor to align to. Pass null to reset.
poseOffset
Pose
The anchor’s pose on the Host device (the “ground truth”).
// Align to shared anchor
MRUK.Instance.SetCustomWorldLockAnchor(resolvedAnchor, anchorPoseOnHost);

// Reset to default
MRUK.Instance.SetCustomWorldLockAnchor(null, Pose.identity);

Step-by-step workflow

World Lock Colocation requires two separate sharing mechanisms:
  • Meta’s Shared Spatial Anchors API — shares the anchor itself between devices
  • Your networking solution (e.g., Photon) — shares the anchor’s UUID and pose offset
The Unity-SharedSpatialAnchors sample project demonstrates this complete workflow.

Host workflow

Step 1: Create a spatial anchor
var anchorGO = new GameObject("AlignmentAnchor");
var anchor = anchorGO.AddComponent<OVRSpatialAnchor>();

// Wait for anchor creation
while (!anchor.Created)
    await Task.Yield();
Step 2: Share the anchor via Meta’s Shared Spatial Anchors API
This makes the anchor available for other devices to retrieve:
var users = new List<OVRSpaceUser> { /* target users */ };
await anchor.ShareAsync(users);
Step 3: Capture the anchor’s pose and share via your networking solution
The pose offset is the “ground truth” that peers need for alignment:
// Capture the anchor's current pose
var anchorPoseOnHost = new Pose(anchor.transform.position, anchor.transform.rotation);

// Share anchor UUID + pose via your networking solution (e.g., Photon room properties)
PhotonAnchorManager.PublishAlignmentAnchor(anchor.Uuid, anchorPoseOnHost);
The Host doesn’t need to call SetCustomWorldLockAnchor — MRUK’s default world locking already works for them. The API is for peers to align to the Host’s coordinate system.

Peer workflow

Step 1: Get the anchor UUID and pose from your networking solution
// Retrieve alignment data from your networking solution (e.g., Photon room properties)
Guid anchorUuid = PhotonAnchorManager.GetAlignmentAnchorUuid();
Pose anchorPoseOnHost = PhotonAnchorManager.GetAlignmentAnchorPose();
Step 2: Retrieve the anchor via Meta’s Shared Spatial Anchors API
var anchors = new List<OVRSpatialAnchor>();
var result = await OVRSpatialAnchor.LoadUnboundAnchorsAsync(
    new List<Guid> { anchorUuid },
    anchors
);

if (!result.Success || anchors.Count == 0)
{
    Debug.LogError("Failed to retrieve shared anchor");
    return;
}

var resolvedAnchor = anchors[0];
Step 3: Call SetCustomWorldLockAnchor to align coordinate systems
// This is the key MRUK call that aligns the peer to the host
MRUK.Instance.SetCustomWorldLockAnchor(resolvedAnchor, anchorPoseOnHost);

Reset when done (optional)

For experiences that shift between single-player and multiplayer modes:
MRUK.Instance.SetCustomWorldLockAnchor(null, Pose.identity);

SharedSpatialAnchors Unity Sample (Reference Implementation)
This is the reference implementation for World Lock Colocation. Open Scene 1 to see the complete flow in action. Key files to study:
  • Alignment.SetMRUKOrigin() — The pattern to follow for calling SetCustomWorldLockAnchor
  • SharedAnchor.cs — Host and Peer alignment logic
  • PhotonAnchorManager.cs — Networking the alignment data
View sample
Colocated Experiences MR Motif
This MR Motif guides you from the basics of Spatial Anchors, through network sharing with Colocation Discovery and Shared Spatial Anchors, to building fully co-located experiences.
View sample

Troubleshooting guide

🛠️ Anchor Fails to Resolve on Peer

Ensure both devices are on the same network and that the anchor was successfully shared. Check that Enhanced Spatial Services is enabled on both headsets (Settings → Privacy & Safety → Device Permissions).

🛠️ Objects Still Misaligned After SetCustomWorldLockAnchor

Verify that EnableWorldLock = true on the MRUK component. Also ensure you're passing the correct anchorPoseOnHost—this must be the pose captured on the Host's device, not the Peer's local pose.

🛠️ World Appears Tilted

MRUK filters to yaw-only rotation to keep the world level. If you see tilt, check that your anchor wasn't created at an unusual orientation. Create anchors at level surfaces when possible.

🛠️ Coordinate Systems Drift Over Time

This is expected behavior—tracking naturally drifts. SetCustomWorldLockAnchor continuously compensates for this drift every frame. If drift seems excessive, ensure the shared anchor is well-lit and has good visual features for tracking.


When to use SetCustomWorldLockAnchor vs Space Sharing

FeatureSetCustomWorldLockAnchorSpace Sharing
Purpose
Align coordinate systems across devices
Share detailed Scene data (walls, floors, furniture)
What’s shared
Single anchor + pose
Full room geometry and semantic labels
Use case
Lightweight colocation for any multiplayer app
Rich MR experiences that react to room layout
Complexity
Simpler—just one anchor
More complex—full Scene Model synchronization
Recommendation: Use SetCustomWorldLockAnchor when you just need coordinate alignment. Use Space Sharing when guests also need the Host’s Scene Model (room layout, furniture positions, etc.).

Previous: Space Sharing
Explore more MRUK documentation topics to dive deeper into spatial queries, content placement, manipulation, sharing, and debugging.
Core Concepts
  • Overview Get an overview of MRUK’s key areas and features.
  • Getting Started Set up your project, install MRUK, and understand space setup with available Building Blocks.
  • Manage Scene Data Work with MRUKRoom, EffectMesh, anchors, and semantic labels to reflect room structure.
Colocation & Sharing
  • Space Sharing Share detailed Scene data across devices for rich colocated MR experiences.
  • Shared Spatial Anchors Learn the fundamentals of creating and sharing spatial anchors across devices.
  • Colocation Discovery Discover nearby devices and establish shared sessions for multiplayer.
Debugging
  • Debug Your MRUK App Use tools like the Scene Debugger and EffectMesh to validate anchor data and scene structure.
Mixed Reality Design Principles
Did you find this page helpful?