Colocation sample with Photon Fusion
Updated: May 10, 2026
This sample demonstrates local multiplayer in mixed reality using a three-phase colocation flow: matchmaking, connection, and alignment. It uses Photon Fusion for networking and Shared Spatial Anchors for spatial alignment between devices.
| Phase | Mechanism | Description |
|---|
Matchmaking | UDP broadcast on port 9876 | Discovers nearby players on local network |
Connection | Photon Fusion | Establishes networked session |
Alignment | Shared Spatial Anchors | Aligns coordinate spaces across devices |
- INetworkData — Interface for network data abstraction
- INetworkMessenger — Interface for network messaging abstraction
- FusionNetworkData — Photon Fusion implementation of
INetworkData - FusionMessenger — Photon Fusion implementation of
INetworkMessenger - State authority routing via
HasStateAuthority check - Two-hop targeted RPC pattern for directed messages
- INetworkStruct serialization wrappers for custom data types
Create → Save to Cloud → Share → Localize → Align
- Create —
OVRSpatialAnchor instantiation at a shared physical location - Save to cloud — Persist anchor data for sharing
- Share — Make anchor available to other users
- Localize — Other devices find and resolve the shared anchor
- Align —
AlignCameraToAnchor adjusts coordinate space
// Interfaces allow swapping network backends
public interface INetworkData { /* state synchronization */ }
public interface INetworkMessenger { /* RPC messaging */ }
// Photon Fusion implementations
public class FusionNetworkData : INetworkData { }
public class FusionMessenger : INetworkMessenger { }
Colocation package functionality has been ported to Multiplayer Building Blocks for SDK v65+. New projects should use the Building Blocks approach.
- Quest with Horizon OS
- Unity for Quest development
- Photon Fusion 1 App ID
git clone https://github.com/oculus-samples/Unity-LocalMultiplayerMR.git
cd colocation-sample-fusion
- Open the project in Unity
- Configure your Photon Fusion App ID in the Fusion settings
- Enable Shared Spatial Anchors in Quest settings
- Build and deploy to two or more Quest devices on the same local network