Meta Camera Integration Photo

Level 4

Overview

The Meta Camera API Integration Photo sample is provided with full source code and demonstrates how Fusion can be used to share photos taken with the Meta Quest camera with remote users.

Each user can take snapshot of their Meta Quest camera by using a button on their watch (or controllers' primary button). At this point, a photo is spawned for all users and the picture is displayed after a few seconds when the transfer is complete.

Need video streaming ?

Another sample showing how to stream video from the Meta camera is available here for Circle members :

Technical Info

  • This sample uses the Shared Authority topology,

  • The project has been developed with Unity 6, Fusion 2 and tested with the following packages :

    • Meta XR Core SDK 74.0.0 : com.meta.xr.sdk.core
    • Unity OpenXR Meta 2.1.0 : com.unity.xr.meta-openxr
  • Headset firmware version: v74 & v76

  • Compilation : make sure in project settings that XR Plug-in Management/OpenXR/Meta XR Subsampled Layout option is disabled (it is restored after each Unity restart).

Before you start

To run the sample :

  • Create a Fusion AppId in the PhotonEngine Dashboard and paste it into the App Id Fusion field in Real Time Settings (reachable from the Fusion menu).

  • Create a Voice AppId in the PhotonEngine Dashboard and paste it into the App Id Voice field in Real Time Settings

Download

Version Release Date Download
2.0.5 May 13, 2025 Fusion Meta Camera Integration Photo 2.0.5 Build 876

Download APK

A demo version of this sample is available below :

Folder Structure

The main folder /MetaCameraIntegration contains all elements specific to this sample.

The folder /IndustriesComponents contains components shared with others industries samples.

The /Photon folder contains the Fusion and Photon Voice SDK.

The /Photon/FusionAddons folder contains the Industries Addons used in this sample.

The /Photon/FusionAddons/FusionXRShared folder contains the rig and grabbing logic coming from the VR shared sample, creating a FusionXRShared light SDK that can be shared with other projects.

The /XR folder contains configuration files for virtual reality.

Architecture overview

The Meta Camera API Integration Photo sample is based on the same code base as that described in the VR Shared page, notably for the rig synchronization.

Aside from this base, the sample, like the other Industries samples, contains some extensions to the Industries Addons, to handle some reusable features like synchronized rays, locomotion validation, touching, teleportation smoothing or a gazing system.

The picture streaming itself rely on Fusion's data streaming API. Note that the data streaming API bandwidth is limited on purpose, as Fusion is first and foremost a realtime SDK and not a protocol for large data transfers. For more frequent streaming (for video use cases for instance), the Photon Video SDK would match this need, and its usage with the Meta Camera is demonstrated in the dedicated sample mentioned earlier.

Meta Quest Sample

The SampleSceneMetaQuestOnly scene is very simple, because the passthrough is enabled and there is no 3D environment.
Each user who connects is represented by an avatar and can decide to take a snapshot using the watch touchscreen, or a controller primary button.
At this point, a photo is spawned for all users. The picture is displayed immediatly for the local user and after a few seconds for remote users (when the transfer is complete).

Network Connection

The network connection is managed by the Meta building blocks [BuildingBlock] Network Manager && [BuildingBlock] Auto Matchmaking.

[BuildingBlock] Auto Matchmaking set the room name and Fusion topology (Shared mode).

[BuildingBlock] Network Manager contains the Fusion's NetworkRunner. The UserSpawnercomponent, placed on it, spawns the user prefab when the user joins the room and handles the Photon Voice connection.

Camera Permission

In order to access to the Meta Quest Camera, it is required to request the permissions.
This is managed by the WebCamTextureManager & PassthroughCameraPermissions components located on the WebCamTextureManagerPrefab game object.
Both scripts are provided by Meta in the Unity-PassthroughCameraAPISamples.
The WebCamTextureManagerPrefab scene game object is disabled by default and it is automatically activated by the VoiceConnectionFadeManager when the Photon Voice connection is established. It is required to prevent running several authorization requests at the same time.

Photo transfer

To transmit snapshots to remote users, we use the Data Sync Helpers addon which rely on the Fusion SendReliableDataToPlayer API.

The player prefab has a CameraPhotoSpawner component. It contains the method CreatePicture() which spawns the photo prefab. The photo is initialized with the Quest camera texture and the transmission is triggered by the cameraPicture.SetPictureTexture() method.

Because of bandwitdh limitation in Fusion SendReliableDataToPlayer API, the streamRatio parameters allows to reduce the photo resolution, and therefore the snapshot transfer duration.

Also, to avoid congestion, CameraPhotoSpawner includes protection against too many simultaneous transfer requests (by default, a frequency of one request every 5 seconds is authorised).
The StreamingCoolDownVisual component displays a visual feedback when the user can not spawn a new photo due to streaming protection.

Since CameraPicture inherits from the StreamSynchedBehaviour class, remote users get notified of data reception by the OnDataProgress() callback.
The OnDataChunkReceived() is called when the photo transmission is completed.

Watch Interaction

The user can take a snapshot using the watch (or controllers' primary button).

For this, the watch button game object contains a SpatialButton component which calls the WatchUIManager TakePhoto() methods when the user touches the watch (thanks to the Toucher located on the MetaHardwareRig).

Please note that the prefab spawned for each user contains 2 watches:
- one for the hand model driven by the controllers
- one for the hand model driven by the finger tracking

The NetworkHandRepresentationManager enables/disables watches according to current hand trackind mode.

Camera Resolution

The user can change the Meta camera resolution at runtime using the parameter button under the left hand.

A UI is then displayed, showing the different resolutions supported by the Meta Camera API. The photo resolution is automatically adapted according to the Meta Camera resolution setting and the streamRatio factor.

Used XR Addons & Industries Addons

To make it easy for everyone to get started with their 3D/XR project prototyping, we provide a few free addons.
See XR Addons for more details.
Also, we provide to our Industries Circle members a comprehensive list of reusable addons.
See Industries Addons for more details.

Here are the addons we've used in this sample.

XRShared

XRShared addon provides the base components to create a XR experience compatible with Fusion.
It is in charge of the players' rig parts synchronization, and provides simple features such as grabbing and teleport.

See XRShared for more details.

Voice Helpers

We use the VoiceHelpers addon for the voice integration.

See VoiceHelpers Addon for more details.

Data Sync Helpers

This addon is used here to synchronize photos between users.

See Data Sync Helpers Industries Addons for more details.

Meta Core Integration

We use the MetaCoreIntegration addon to synchronize players' hands.

See MetaCoreIntegration Addon for more details.

XRHands synchronization

The XR Hands Synchronization addon shows how to synchronize the hand state of XR Hands's hands (including finger tracking), with high data compression.

See XRHands synchronization Addon for more details.

3rd Party Assets and Attributions

The sample is built around several awesome third party assets:

Back to top