MRUK) Space Sharing workflow for synchronizing real-world scene entities across multiple devices. A host loads local scene data, shares room anchors to Meta’s cloud under a group UUID, and guests download that shared data with automatic world alignment. The sample uses Photon PUN for networking, but the MRUK Space Sharing APIs are networking-agnostic.MRUK.Instance.LoadSceneFromDevice()MRUK.ShareRoomsAsync()MRUK.Instance.LoadSceneFromSharedRooms()alignmentData parameterMRUK Space Sharing with a networking solution by transmitting group UUIDs and alignment dataMenu.unity scene and build to your Quest device. Launch the app, select “MRUK Space Sharing w/ Photon (PUN)”, and create or join a Photon room to begin exploring Space Sharing.MRUK API calls, Photon networking, and UI workflows.| File / Scene | What it demonstrates | Key concepts |
|---|---|---|
Assets/Scenes/Menu.unity | Main menu launcher | Simple scene loader |
Assets/Scenes/LocalSpaceSharing.unity | Space sharing scene with UI panels | Host/guest coordination, room lifecycle |
Assets/Scripts/MRSceneManager.cs | Core MRUK Space Sharing API calls | LoadSceneFromDevice(), ShareRoomsAsync(), LoadSceneFromSharedRooms() |
Assets/Scripts/PhotonRoomManager.cs | Photon PUN room lifecycle and custom property sync | Room creation, property versioning, event firing |
Assets/Scripts/LocalSpaceSharingUI.cs | UI button callbacks and auto-load logic | Guest auto-load on property update |
Assets/Scripts/PhotonExtensions.cs | Custom Photon serializers for Guid and Pose | Photon type registration |
Assets/Scripts/ExposedAnchorPrefabSpawner.cs | Wrapper around MRUK’s AnchorPrefabSpawner | Anchor mesh visualization toggle |
Assets/Scripts/AlignPlayer.cs | Manual floor anchor alignment (no longer used) | Previous manual alignment pattern |
Assets/Scripts/Sampleton.cs | Central singleton for scene management and logging | Platform SDK initialization, nickname handling |
Assets/Scripts/SampleExtensions.cs | Utility extensions for room presence and logging | IsInLoadedRoom(), error formatting |
OculusProjectConfig.asset | Project-level OVR settings | Shared anchor support, scene support, passthrough |
AndroidManifest.xml | Android permissions | USE_ANCHOR_API, IMPORT_EXPORT_IOT_MAP_DATA, USE_SCENE |
MRUK Space Sharing w/ Photon (PUN)” to load the space sharing scene. The UI shows a lobby panel with “Create New Room” and “Find Room” buttons, which remain disabled until Photon connects to the master server.MRUK Space Sharing follows a three-step host/guest pattern:MRUK.Instance.LoadSceneFromDevice().MRUK.ShareRoomsAsync() and transmits the group UUID to guests via the networking layer.MRUK.Instance.LoadSceneFromSharedRooms() with the group UUID to download and align the shared anchors.// Host shares (simplified) var result = await mruk.ShareRoomsAsync(mruk.Rooms, groupId);
MRSceneManager.cs.Guid.NewGuid() for a fresh UUID each session, Application.buildGUID so all instances of the same build share one group, or a hardcoded GUID for a fixed sharing namespace. The chosen UUID is transmitted to other clients via Photon room properties.GetSharedGroupId() in MRSceneManager.cs.LoadSceneFromSharedRooms(), passing the host’s floor anchor pose as alignmentData enables automatic world alignment. The sample captures the host’s floor pose and transmits it via Photon room properties. MRUK uses this data to transform the loaded room so that non-anchored virtual objects appear at the same world positions for all clients.// Guest loads with alignment
var result = await MRUK.Instance.LoadSceneFromSharedRooms(
roomIds, groupUuid, alignmentData: hostAlignment, removeMissingRooms: true
);
LoadSharedSceneImpl() and SetHostAlignment() in MRSceneManager.cs.PublishRoomData() and OnRoomPropertiesUpdate() in PhotonRoomManager.cs.System.Guid or UnityEngine.Pose. The sample registers custom serializers using Protocol.TryRegisterType() at startup. Guid serializes as 16 raw bytes; Pose serializes as 7 floats (3 for position, 4 for rotation).PhotonExtensions.cs.