Table of Contents

Class ARCoreFrameSource

Namespace
easyar
Assembly
EasyAR.Sense.dll

The MonoBehaviour controlling the ARCore camera device (easyar.ARCoreCameraDevice) in the scene, providing functional extensions in the Unity environment.

This frame source is a motion tracking device that outputs motion data in the ARSession.

public class ARCoreFrameSource : FrameSource
Inheritance
ARCoreFrameSource
Inherited Members

Fields

DesiredFocusMode

The desired focus mode. Modifications are effective only before the DeviceOpened event or OnEnable.

Note: Due to hardware or system limitations, the focus switch may be ineffective on some devices.

public ARCoreCameraDeviceFocusMode DesiredFocusMode

Field Value

Properties

Camera

Provided only when creating a new frame source. It is accessed solely during the Assemble() process.

On desktop devices or mobile phones, this camera represents the Camera in the virtual world corresponding to the physical camera device in the real environment. Its projection matrix and position will correspond to the real camera and are controlled by EasyAR. On a head-mounted display, this camera is only used to display diagnostic text in front of the eyes, not for rendering the scene image. The camera is not controlled by EasyAR.

protected override Camera Camera { get; }

Property Value

CameraCandidate

Alternative to the Camera, effective only when Unity XR Origin is not used. If not set, Camera.main will be used.

public Camera CameraCandidate { get; set; }

Property Value

CameraFrameStarted

Provided only when creating a new frame source. It is accessed throughout the lifetime of the ARSession.

Whether camera frame input has started.

protected override bool CameraFrameStarted { get; }

Property Value

DeviceCameras

Provided only when creating a new frame source. It is accessed only when CameraFrameStarted is true.

Provides the device camera supplying the camera frame data. If the camera frame data is provided by multiple cameras, the list needs to include all of them.

Ensure the value is correct when CameraFrameStarted is true.

protected override List<FrameSourceCamera> DeviceCameras { get; }

Property Value

Display

Provided only when creating a new frame source. It is accessed solely during the Assemble() process.

Provides the display system information. You can use DefaultSystemDisplay or DefaultHMDDisplay to get the default display information.

protected override IDisplay Display { get; }

Property Value

FrameRateRange

Frame rate range. Available only when Opened is true.

public Vector2 FrameRateRange { get; }

Property Value

IsAvailable

Provided only when creating a new frame source. It is accessed solely during the Assemble() process.

Whether the current frame source is available.

If the value is null, CheckAvailability() will be called, and the value will be obtained after the Coroutine finishes.

protected override Optional<bool> IsAvailable { get; }

Property Value

IsCameraUnderControl

Provided only when creating a new frame source. It is accessed solely during the Assemble() process.

When true, the session will update the camera's transform and render the camera image.

When creating a head-mounted display extension, it should be false. You should have full control over the 3D camera in the scene. You should handle camera rendering, especially in VST mode.

protected override bool IsCameraUnderControl { get; }

Property Value

IsHMD

Provided only when creating a new frame source. It is accessed solely during the Assemble() process.

Whether the current frame source is a head-mounted display. If it is a head-mounted display, diagnostic information will be displayed on a 3D board in front of the camera.

Some frame filters may behave differently when running on the device.

protected override bool IsHMD { get; }

Property Value

Opened

Whether the camera is open.

public bool Opened { get; }

Property Value

Size

Current image size. Available only when Opened is true.

public Vector2Int Size { get; }

Property Value

Methods

Close()

Close the device.

public void Close()

OnSessionStart(ARSession)

Provided only when creating a new frame source. It is accessed solely during the StartSession() process.

Handles session startup if this frame source has been assembled into the Assembly. This method is designed for lazy initialization; you can perform AR-specific initialization work here.

protected override void OnSessionStart(ARSession session)

Parameters

session

OnSessionStop()

Provided only when creating a new frame source. It is accessed during StopSession(bool) or other session stop/corruption processes.

Handles session stopping if this frame source has been assembled into the Assembly. You can use this method to destroy resources created during StartSession() and session runtime, and restore the internal state. This method is guaranteed to be called before the session is destroyed. If the frame source is destroyed before the session, this method will not be called, and the session will become corrupted.

protected override void OnSessionStop()

Open()

Open the device. If Open() and Close() are not called manually, the device will automatically Open() after the ARSession starts.

public void Open()

Events

DeviceClosed

Device closed event.

public event Action DeviceClosed

Event Type

DeviceOpened

Device opened event, the bool value indicates success or failure.

public event Action<bool, PermissionStatus, string> DeviceOpened

Event Type