Class ARKitFrameSource
- Namespace
- easyar
- Assembly
- EasyAR.Sense.dll
AMonoBehaviour controlling the ARKit camera device (easyar.ARKitCameraDevice) in the scene, providing functional extensions within the Unity environment.
This frame source is a motion-tracking device that outputs motion data within theARSession.
public class ARKitFrameSource : FrameSource
- Inheritance
-
ARKitFrameSource
- Inherited Members
Fields
DesiredFocusMode
The desired focus mode; modifications are only effective before theDeviceOpened event or OnEnable.
Note: Due to hardware or system limitations, the focus switch may be ineffective on some devices.
public ARKitCameraDeviceFocusMode DesiredFocusMode
Field Value
Properties
Camera
Provided only when creating a new frame source. Accessed only duringAssemble().
On desktops or phones, this camera represents the virtualCamera corresponding to the real-world camera device; its projection matrix and position align with the real camera, controlled by EasyAR. On head-mounted devices, this camera is solely for displaying diagnostic text in front of the eyes, not for rendering; it is not controlled by EasyAR.
protected override Camera Camera { get; }
Property Value
CameraCandidate
An alternative toCamera, effective only when Unity XR Origin is not used; uses Camera.main if not set.
public Camera CameraCandidate { get; set; }
Property Value
CameraFrameStarted
Provided only when creating a new frame source. Accessed throughout the lifetime ofARSession.
Whether camera frame input has started.
protected override bool CameraFrameStarted { get; }
Property Value
DesiredFrameRate
Desired camera image frame rate; modifications are only effective before theDeviceOpened event.
Uses the closest value inSupportedFrameRate. Default value is used if not set.
public Optional<double> DesiredFrameRate { get; set; }
Property Value
DesiredSize
Desired camera image size; modifications are only effective before theDeviceOpened event.
Uses the closest value inSupportedSize. Default value is used if not set.
public Optional<Vector2Int> DesiredSize { get; set; }
Property Value
DeviceCameras
Provided only when creating a new frame source. Accessed whenCameraFrameStarted is true.
Provides the device camera supplying camera frame data. If data comes from multiple cameras, the list must include all.
Ensure the value is correct whenCameraFrameStarted is true.
protected override List<FrameSourceCamera> DeviceCameras { get; }
Property Value
Display
Provided only when creating a new frame source. Accessed only duringAssemble().
Provides display system information. UseDefaultSystemDisplay orDefaultHMDDisplay to get default display info.
protected override IDisplay Display { get; }
Property Value
FrameRate
Current frame rate of the device. Only available whenOpened is true.
set uses the closest value inSupportedFrameRate.
public double FrameRate { get; set; }
Property Value
IsAvailable
Provided only when creating a new frame source. Accessed only duringAssemble().
Whether the current frame source is available.
If null,CheckAvailability() is called; the value is obtained after theCoroutine ends.
protected override Optional<bool> IsAvailable { get; }
Property Value
IsCameraUnderControl
Provided only when creating a new frame source. Accessed only duringAssemble().
When true, the session updates the camera's transform and renders the camera image.
When creating head-mounted extensions, it should be false. You should fully control the 3D camera in the scene. Handle camera rendering, especially in VST-mode.
protected override bool IsCameraUnderControl { get; }
Property Value
IsHMD
Provided only when creating a new frame source. Accessed only duringAssemble().
Whether the current frame source is head-mounted. If head-mounted, diagnostic info displays on a 3D board in front of the camera.
Some frame filters behave differently on head-mounted devices.
protected override bool IsHMD { get; }
Property Value
Opened
Whether the camera is open.
public bool Opened { get; }
Property Value
Size
Current image size. Only available whenOpened is true.
set uses the closest value inSupportedSize.
If the image size is modified duringFrameRecorder recording, recording data will stop updating; close and restart recording is required.
public Vector2Int Size { get; set; }
Property Value
SupportedFrameRate
All supported frame rates for the current device. Only available whenOpened is true.
public List<double> SupportedFrameRate { get; }
Property Value
SupportedSize
All supported image sizes for the current device. Only available whenOpened is true.
public List<Vector2Int> SupportedSize { get; }
Property Value
Methods
Close()
Closes the device.
public void Close()
OnSessionStart(ARSession)
Provided only when creating a new frame source. Accessed only duringStartSession().
Handles session start if this frame source is assembled intoAssembly. Designed for lazy initialization; perform AR-specific setup here.
protected override void OnSessionStart(ARSession session)
Parameters
session
OnSessionStop()
Provided only when creating a new frame source. Accessed duringStopSession(bool) or other session stop/corruption processes.
Handles session stop if this frame source is assembled intoAssembly. Use this to destroy resources created inStartSession() or during session runtime and restore internal state. Guaranteed to be called before session destruction. If the frame source is destroyed before the session, this won't be called, and the session will be corrupted.
protected override void OnSessionStop()
Open()
Opens the device. IfOpen() andClose() are not called manually,ARSession will automaticallyOpen() upon starting.
public void Open()
Events
DeviceClosed
Device closed event.
public event Action DeviceClosed
Event Type
DeviceOpened
Device opened event; the bool value indicates success.
public event Action<bool, PermissionStatus, string> DeviceOpened