Class UCameraManager
- Namespace
- Uralstech.UXR.QuestCamera
Class for interfacing with the native Camera2 API on Android.
public class UCameraManager : DontCreateNewSingleton<UCameraManager>
- Inheritance
-
objectUCameraManager
Fields
AvatarCameraPermission
The permission required to access the Meta Quest's avatar camera.
public const string AvatarCameraPermission = "android.permission.CAMERA"
Field Value
- string
HeadsetCameraPermission
The permission required to access the Meta Quest's Passthrough 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
Gets a cached array of the available cameras and their characteristics.
public CameraInfo[]? Cameras { get; }
Property Value
Remarks
The disposal of the CameraInfo objects generated by this property are managed by the UCameraManager instance. If you require control of the CameraInfo objects, use GetCameraInfos() instead.
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
eyeCameraInfo.CameraEyeThe eye.
Returns
- CameraInfo
A CameraInfo object or null if none were found.
Remarks
The CameraInfo object returned by this method is managed by the UCameraManager instance, so do not dispose it manually.
GetCameraInfos()
Gets all available cameras and their characteristics. This is not cached.
public CameraInfo[]? GetCameraInfos()
Returns
- CameraInfo[]
An array of CameraInfo objects or null if any errors occurred.
Remarks
You will have to manage the disposal of the CameraInfo objects returned by this method. Use Cameras if you don't want to handle the objects yourself.
OnDestroy()
protected void OnDestroy()
OpenCamera(string)
Opens a camera device for use.
public CameraDevice? OpenCamera(string camera)
Parameters
camerastringThe ID of the camera to open; accepts CameraInfo objects through an implicit cast.
Returns
- CameraDevice
A CameraDevice object or null if any errors occurred.
Remarks
Once you have finished using the camera, close and dispose of it using DisposeAsync().
RefreshCachedCameraInfos()
Refreshes the cached array of camera devices.
public bool RefreshCachedCameraInfos()