Table of Contents

Class UCameraManager

Class for interfacing with the native Camera2 API on Android.

public class UCameraManager : DontCreateNewSingleton<UCameraManager>
Inheritance
object
UCameraManager

Fields

AvatarCameraPermission

The permission required to access the Meta Quest Avatar Camera.

public const string AvatarCameraPermission = "android.permission.CAMERA"

Field Value

string

HeadsetCameraPermission

The permission required to access the Meta Quest's cameras.

public const string HeadsetCameraPermission = "horizonos.permission.HEADSET_CAMERA"

Field Value

string

YUVToRGBAComputeShader

The compute shader to use to convert the camera's YUV 4:2:0 images to RGBA.

public ComputeShader YUVToRGBAComputeShader

Field Value

ComputeShader

Properties

Cameras

Returns all available cameras and their characteristics. This is a cached value.

public CameraInfo[] Cameras { get; }

Property Value

CameraInfo[]

Methods

Awake()

protected override void Awake()

GetCamera(CameraEye)

Gets a camera device by the eye it is closest to.

public CameraInfo GetCamera(CameraInfo.CameraEye eye)

Parameters

eye CameraInfo.CameraEye

The eye.

Returns

CameraInfo

The camera's CameraInfo, null if not found.

OnDestroy()

protected void OnDestroy()

OpenCamera(string)

Opens a camera device for use.

public CameraDevice OpenCamera(string camera)

Parameters

camera string

The ID of the camera. You can get it from Cameras or GetCamera(CameraEye).

Returns

CameraDevice

A new camera device wrapper. May be null if the current object is disposed/unusable.

Remarks

Once you have finished using the camera, either destroy its GameObject or call Release() to close the camera and free up native resources.