ARKitFrameSource Class

Description

MonoBehaviour which controls ARKit camera device ( ARKitCameraDevice ) in the scene, providing a few extensions in the Unity environment.

This frame source is one type of motion tracking device, and will output motion data in a ARSession .


Fields

DesiredFocusMode

C#

public ARKitCameraDeviceFocusMode DesiredFocusMode

Desired focus mode. Only effective if modified before the ARKitFrameSource.DeviceOpened event or OnEnable.

Note: focus switch may not work on some devices due to hardware or system limitation.


Properties

enabled

C#

public bool enabled { get; set; }

Start/Stop video stream capture when ARSession is running. Capture will start only when MonoBehaviour .enabled is true after session started.

Opened

C#

public bool Opened { get; }

Whether camera is opened.

SupportedSize

C#

public List< Vector2Int > SupportedSize { get; }

Supported preview size of current device. Only usable when ARKitFrameSource.Opened is true.

SupportedFrameRate

C#

public List<double> SupportedFrameRate { get; }

Supported frame rates of current device. Only usable when ARKitFrameSource.Opened is true.

Size

C#

public Vector2Int Size { get; set; }

Current preview size. Only usable when ARKitFrameSource.Opened is true.

The nearest value from ARKitFrameSource.SupportedSize will be used when set.

If the image size is modified during the FrameRecorder recording process, the recording data will stop updating. You will need to stop and restart the recording.

FrameRate

C#

public double FrameRate { get; set; }

Current frame rate. Only usable when ARKitFrameSource.Opened is true.

The nearest value from ARKitFrameSource.SupportedFrameRate will be used when set.

DesiredSize

C#

public Optional< Vector2Int > DesiredSize { get; set; }

Desired camera preview size. Only effective if modified before the ARKitFrameSource.DeviceOpened event.

The nearest value from ARKitFrameSource.SupportedSize will be used. Default value will be used if not set.

DesiredFrameRate

C#

public Optional<double> DesiredFrameRate { get; set; }

Desired camera frame rate. Only effective if modified before the ARKitFrameSource.DeviceOpened event.

The nearest value from ARKitFrameSource.SupportedFrameRate will be used. Default value will be used if not set.

CameraCandidate

C#

public Camera CameraCandidate { get; set; }

ARKitFrameSource.Camera candidate. Only effective if Unity XR Origin is not used. Camera.main will be used if not specified.


Events

DeviceOpened

C#

public event Action<bool, PermissionStatus , string> DeviceOpened

Event when device opened. The bool value indicates if open success.

DeviceClosed

C#

public event Action DeviceClosed

Event when device closed.


Methods

Open

C#

public void Open()

Open device. If neither ARKitFrameSource.Open nor ARKitFrameSource.Close is called manually, ARKitFrameSource.Open will be automatically invoked upon ARSession startup.

Close

C#

public void Close()

Close device.