Google is committed to advancing racial equity for Black communities. See how.

GoogleARCore.Session

Represents an ARCore session, which is an attachment point from the app to the ARCore service.

Summary

Holds information about the global state for ARCore, manages tracking of Anchors and Planes, and performs hit tests against objects ARCore is tracking in the world.

Properties

LostTrackingReason
Gets the reason for ARCore having lost tracking.
PlaybackStatus
The current state of playback.
RecordingStatus
The current state of the recorder.
Status
static SessionStatus
Gets current session status.

Public static functions

CheckApkAvailability()
AsyncTask< ApkAvailabilityStatus >
Checks the availability of the ARCore APK on the device.
CreateAnchor(Pose pose, Trackable trackable)
Creates a new Anchor at the given Pose that is attached to the Trackable.
GetCameraConfig()
Get the camera configuration the ARCore session is currently running with.
GetTrackables< T >(List< T > trackables, TrackableQueryFilter filter)
void
Gets Trackables ARCore has tracked.
IsDepthModeSupported(DepthMode depthMode)
bool
Check whether the depth mode is supported on this device.
RequestApkInstallation(bool userRequested)
AsyncTask< ApkInstallationStatus >
Requests an installation of the ARCore APK on the device.
SetPlaybackDataset(string datasetFilepath)
Sets the filepath for a dataset to be played back.
StartRecording(ARCoreRecordingConfig config)
Starts a new recording, using the provided to define the location to save the dataset and other options.
StopRecording()
Stops the current recording.

Properties

LostTrackingReason

static LostTrackingReason LostTrackingReason

Gets the reason for ARCore having lost tracking.

PlaybackStatus

static PlaybackStatus PlaybackStatus

The current state of playback.

Details
Returns
The current .

RecordingStatus

static RecordingStatus RecordingStatus

The current state of the recorder.

Details
Returns
The current .

Status

static SessionStatus Status

Gets current session status.

Public static functions

CheckApkAvailability

AsyncTask< ApkAvailabilityStatus > CheckApkAvailability()

Checks the availability of the ARCore APK on the device.

Details
Returns
An AsyncTask that completes with an ApkAvailabilityStatus when the availability is known.

CreateAnchor

Anchor CreateAnchor(
  Pose pose,
  Trackable trackable
)

Creates a new Anchor at the given Pose that is attached to the Trackable.

If trackable is null, it creates a new anchor at a world pose. As ARCore updates its understading of the space, it will update the virtual pose of the of the anchor to attempt to keep the anchor in the same real world location.

Details
Parameters
pose
The Unity world pose where the anchor is to be creates.
trackable
The Trackable to attach the Anchor to.
Returns
The newly created anchor or null.

GetCameraConfig

CameraConfig GetCameraConfig()

Get the camera configuration the ARCore session is currently running with.

Details
Returns
The CameraConfig that the ARCore session is currently running with. The value is only correct when there is a valid running ARCore session.

GetTrackables< T >

void GetTrackables< T >(
  List< T > trackables,
  TrackableQueryFilter filter
)

Gets Trackables ARCore has tracked.

Details
Template Parameters
T
The Trackable type to get.
Parameters
trackables
A reference to a list of T that will be filled by the method call.
filter
A filter on the type of data to return.

IsDepthModeSupported

bool IsDepthModeSupported(
  DepthMode depthMode
)

Check whether the depth mode is supported on this device.

Not all devices support depth, see the ARCore supported devices page for details.

Details
Parameters
depthMode
The depth mode.
Returns
true if the depth mode is supported, false if it is not supported or the session has not yet been initialized.

RequestApkInstallation

AsyncTask< ApkInstallationStatus > RequestApkInstallation(
  bool userRequested
)

Requests an installation of the ARCore APK on the device.

Details
Parameters
userRequested
Whether the installation was requested explicitly by a user action.
Returns
An AsyncTask that completes with an ApkInstallationStatus when the installation status is resolved.

SetPlaybackDataset

PlaybackResult SetPlaybackDataset(
  string datasetFilepath
)

Sets the filepath for a dataset to be played back.

The ARCore session must be paused when using this method. Resume the session for the change to take effect.

Details
Parameters
datasetFilepath
The filepath of the dataset. Null if stopping the playback.
Returns
.OK if playback filepath was was set without issue. A different will be returned in the case of an error.

StartRecording

RecordingResult StartRecording(
  ARCoreRecordingConfig config
)

Starts a new recording, using the provided to define the location to save the dataset and other options.

If a recording is already in progress this call will fail, check the before making this call. When an ARCore session is paused, recording may continue, during this time the camera feed will be recorded as a black screen, but sensor data will continue to be captured.

Details
Parameters
config
containing the path to save the dataset along with other recording options.
Returns
.OK if the recording is started (or will start on the next Session resume.) Or a if there was an error.

StopRecording

RecordingResult StopRecording()

Stops the current recording.

If there is no recording in progress, this method will return OK.

Details
Returns
.OK if the recording was stopped successfully, or .ErrorRecordingFailed if there was an error.