Struct ArSession
Represents the context for an ARCore session.
Implements
Inherited Members
Namespace: UnityEngine.XR.ARCore
Assembly: Unity.XR.ARCore.dll
Syntax
public struct ArSession : IEquatable<ArSession>
Remarks
This is an opaque object that represents a native ArSession.
Properties
playbackStatus
Gets the playback status.
Declaration
public ArPlaybackStatus playbackStatus { get; }
Property Value
Type | Description |
---|---|
ArPlaybackStatus | Indicates whether the session is playing back a recording or has stopped because of an error. |
See Also
recordingStatus
Gets the current recording status.
Declaration
public ArRecordingStatus recordingStatus { get; }
Property Value
Type | Description |
---|---|
ArRecordingStatus | Indicates whether the session is recording or has stopped because of an error. |
See Also
Methods
AsIntPtr()
Gets the native pointer for this instance.
Declaration
public IntPtr AsIntPtr()
Returns
Type | Description |
---|---|
IntPtr | The native pointer. |
See Also
Equals(object)
Tests for equality.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | An |
Returns
Type | Description |
---|---|
bool | true if |
Overrides
See Also
Equals(ArSession)
Tests for equality.
Declaration
public bool Equals(ArSession other)
Parameters
Type | Name | Description |
---|---|---|
ArSession | other | The instance to compare against. |
Returns
Type | Description |
---|---|
bool | true if the native pointers are equal. Otherwise, returns false. |
Remarks
Two instances are considered equal if their native pointers are equal.
See Also
FromIntPtr(IntPtr)
Creates an instance from a native pointer. The native pointer must point to an existing native ArSession
.
Declaration
public static ArSession FromIntPtr(IntPtr value)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | value | A pointer to an existing native |
Returns
Type | Description |
---|---|
ArSession | An instance whose native pointer is |
See Also
GetHashCode()
Generates a hash code suitable for use with a HashSet
or Dictionary
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | Returns a hash code for this instance. |
Overrides
See Also
SetPlaybackDataset(string)
Sets an MP4 dataset file to playback instead of live camera feed.
Declaration
public ArStatus SetPlaybackDataset(string path)
Parameters
Type | Name | Description |
---|---|---|
string | path | A file path to a MP4 dataset file or |
Returns
Type | Description |
---|---|
ArStatus |
|
Remarks
Restrictions:
- Can only be called while the session is paused. Playback of the MP4 dataset file starts once the session is resumed.
- The MP4 dataset file must use the same camera facing direction as is configured in the session.
When an MP4 dataset file is set:
- All existing trackables (i.e., anchors and trackables) immediately enter tracking state TrackingState.None.
- The desired focus mode is ignored, and does not affect the previously recorded camera images.
- The current camera configuration is immediately set to the default for the device the MP4 dataset file was recorded on.
- Calls to retrieve the supported camera configurations return camera configs supported by the device the MP4 dataset file was recorded on.
- Setting a previously obtained camera config has no effect.
See Also
StartRecording(ArRecordingConfig)
Starts a new MP4 dataset file recording that is written to the specific filesystem path.
Declaration
public ArStatus StartRecording(ArRecordingConfig recordingConfig)
Parameters
Type | Name | Description |
---|---|---|
ArRecordingConfig | recordingConfig | The configuration defined for recording. |
Returns
Type | Description |
---|---|
ArStatus | Returns Success if successful. Returns one of the following values otherwise: - ErrorIllegalState - ErrorInvalidArgument - ErrorRecordingFailed |
Remarks
Existing files are overwritten.
The MP4 video stream (VGA) bitrate is 5Mbps (40Mb per minute).
Recording introduces additional overhead and may affect app performance.
See Also
StopRecording()
Stops recording and flushes unwritten data to disk. The MP4 dataset file is ready to read after this call.
Declaration
public ArStatus StopRecording()
Returns
Type | Description |
---|---|
ArStatus | Returns Success if successful. Returns ErrorRecordingFailed otherwise. |
Remarks
Recording can be stopped automatically when the session is paused, if auto stop is enabled via SetAutoStopOnPause(ArSession, bool). Recording errors that would be thrown in StopRecording() are silently ignored on session pause.
See Also
Operators
operator ==(ArSession?, ArSession?)
Tests for equality.
Declaration
public static bool operator ==(ArSession? lhs, ArSession? rhs)
Parameters
Type | Name | Description |
---|---|---|
ArSession? | lhs | The nullable |
ArSession? | rhs | The nullable |
Returns
Type | Description |
---|---|
bool | true if any of these conditions are met:
-
|
Remarks
This equality operator lets you compare an instance with null to determine whether its
native pointer is null
.
Examples
bool TestForNull(ArSession obj)
{
if (obj == null)
{
// obj.AsIntPtr() is IntPtr.Zero
}
}
See Also
operator ==(ArSession, ArSession)
Tests for equality. Equivalent to Equals(ArSession).
Declaration
public static bool operator ==(ArSession lhs, ArSession rhs)
Parameters
Type | Name | Description |
---|---|---|
ArSession | lhs | The instance to compare with |
ArSession | rhs | The instance to compare with |
Returns
Type | Description |
---|---|
bool | true if |
See Also
explicit operator IntPtr(ArSession)
Casts an instance to its native pointer.
Declaration
public static explicit operator IntPtr(ArSession session)
Parameters
Type | Name | Description |
---|---|---|
ArSession | session | The instance to cast. |
Returns
Type | Description |
---|---|
IntPtr | The native pointer. |
See Also
operator !=(ArSession?, ArSession?)
Tests for inequality.
Declaration
public static bool operator !=(ArSession? lhs, ArSession? rhs)
Parameters
Type | Name | Description |
---|---|---|
ArSession? | lhs | The nullable |
ArSession? | rhs | The nullable |
Returns
Type | Description |
---|---|
bool | false if any of these conditions are met:
-
|
Remarks
This inequality operator lets you compare an instance with null to determine whether its
native pointer is null
.
Examples
bool TestForNull(ArSession obj)
{
if (obj != null)
{
// obj.AsIntPtr() is not IntPtr.Zero
}
}
See Also
operator !=(ArSession, ArSession)
Tests for inequality. Equivalent to the negation of Equals(ArSession).
Declaration
public static bool operator !=(ArSession lhs, ArSession rhs)
Parameters
Type | Name | Description |
---|---|---|
ArSession | lhs | The instance to compare with |
ArSession | rhs | The instance to compare with |
Returns
Type | Description |
---|---|
bool | false if |