Class ARKitCameraSubsystem
The camera subsystem implementation for ARKit.
Inheritance
Implements
Inherited Members
Namespace: UnityEngine.XR.ARKit
Assembly: Unity.XR.ARKit.dll
Syntax
[Preserve]
public sealed class ARKitCameraSubsystem : XRCameraSubsystem, ISubsystem
Fields
backgroundShaderNames
The names for the background shaders based on the current render pipeline.
Declaration
public static readonly string[] backgroundShaderNames
Field Value
Type | Description |
---|---|
string[] | The names for the background shaders based on the current render pipeline. |
Remarks
There are two shaders in the Apple ARKit Provider Package. One is used for rendering before opaques and one is used for rendering after opaques.
In order:
- Before Opaques Shader Name
- After Opaques Shader Name
Properties
advancedCameraConfigurationSupported
Get whether advanced camera hardware configuration is supported. Advanced camera hardware configuration requires iOS 16 or newer and a device with an ultra-wide camera.
Declaration
public bool advancedCameraConfigurationSupported { get; }
Property Value
Type | Description |
---|---|
bool | true if setting advance camera hardware configurations is supported. Otherwise, false. |
See Also
backgroundShaderName
The name for the background shader.
Declaration
[Obsolete("'backgroundShaderName' is obsolete, use backgroundShaderNames instead. (2022/04/04)")]
public static string backgroundShaderName { get; }
Property Value
Type | Description |
---|---|
string | The name for the background shader. |
Methods
TryAcquireHighResolutionCpuImage()
Creates and returns a promise of a high resolution CPU image. You can yield return
on the promise
in a coroutine to await the asynchronous result.
Requires iOS 16 or newer.
Declaration
public HighResolutionCpuImagePromise TryAcquireHighResolutionCpuImage()
Returns
Type | Description |
---|---|
HighResolutionCpuImagePromise | The promise instance. |
Remarks
See ARKit's captureHighResolutionFrameWithCompletion documentation for more information.
On iOS 15 or below, promises will immediately resolve with an unsuccessful result.
Only one instance of HighResolutionCpuImagePromise at a time can await a result. Promises created while another promise is in progress will immediately resolve with an unsuccessful result.
Examples
IEnumerator MyCoroutine()
{
var promise = TryAcquireHighResolutionCpuImage();
yield return promise;
if (promise.result.wasSuccessful)
Debug.Log(promise.result.highResolutionCpuImage.ToString());
}
TryGetLockedCamera(out ARKitLockedCamera)
Locks the primary camera associated with the current session configuration and returns an object that represents it. Use this object to configure advanced camera hardware properties. For more information, see ARKit's [AVCaptureDevice.lockForConfiguration] (https://developer.apple.com/documentation/avfoundation/avcapturedevice/1387810-lockforconfiguration?language=objc).
Declaration
public bool TryGetLockedCamera(out ARKitLockedCamera lockedCamera)
Parameters
Type | Name | Description |
---|---|---|
ARKitLockedCamera | lockedCamera | A disposable object that represents the locked configurable primary camera. |
Returns
Type | Description |
---|---|
bool | true if a configurable camera is available in the current session configuration and can be locked. Otherwise, false. |
Remarks
Requires iOS 16 or newer and a device with an ultra-wide camera.