Class ARKitSessionSubsystem
ARKit implementation of the XRSessionSubsystem
. Do not create this directly. Use the SubsystemManager
instead.
Inherited Members
Namespace: UnityEngine.XR.ARKit
Syntax
[Preserve]
public sealed class ARKitSessionSubsystem : XRSessionSubsystem
Properties
coachingActivatesAutomatically
Whether the Coaching Overlay activates automatically or not. By default, it does not.
Declaration
public bool coachingActivatesAutomatically { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
coachingActive
true
if the Coaching Overlay is active.
Declaration
public bool coachingActive { get; }
Property Value
Type | Description |
---|---|
Boolean |
coachingGoal
Defines the Coaching Goal. This property is obsolete. Use requestedCoachingGoal or currentCoachingGoal instead.
Declaration
[Obsolete("Use requestedCoachingGoal or currentCoachingGoal instead. (2020-01-17)")]
public ARCoachingGoal coachingGoal { get; set; }
Property Value
Type | Description |
---|---|
ARCoachingGoal |
coachingOverlaySupported
true
if Coaching Overlay is supported, otherwise false
.
Declaration
public static bool coachingOverlaySupported { get; }
Property Value
Type | Description |
---|---|
Boolean |
collaborationDataCount
The number of ARCollaborationDatas in the queue. Obtain ARCollaborationData with DequeueCollaborationData().
Declaration
public int collaborationDataCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
See Also
collaborationEnabled
Queries whether collaboration is currently enabled.
Declaration
public bool collaborationEnabled { get; }
Property Value
Type | Description |
---|---|
Boolean |
collaborationRequested
Get whether collaboration is enabled. When collaboration is enabled, collaboration data is accumulated by the subsystem until you read it out with DequeueCollaborationData().
Declaration
public bool collaborationRequested { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
Note: If you change this value, the new value might not be reflected until the next frame.
See Also
currentCoachingGoal
The current Coaching Goal. This can be different than the requestedCoachingGoal.
Declaration
public ARCoachingGoal currentCoachingGoal { get; }
Property Value
Type | Description |
---|---|
ARCoachingGoal | The type of goal the coaching overlay will guide the user through. |
currentWorldAlignment
The current ARWorldAlignment for the session.
Declaration
public ARWorldAlignment currentWorldAlignment { get; }
Property Value
Type | Description |
---|---|
ARWorldAlignment |
requestedCoachingGoal
Requests the Coaching Goal. This should be based on your app's tracking requirements and affects the UI that the coaching overlay presents.
Declaration
public ARCoachingGoal requestedCoachingGoal { get; set; }
Property Value
Type | Description |
---|---|
ARCoachingGoal | The type of goal the coaching overlay should guide the user through. |
requestedWorldAlignment
The requested ARWorldAlignment for the session.
Declaration
public ARWorldAlignment requestedWorldAlignment { get; set; }
Property Value
Type | Description |
---|---|
ARWorldAlignment |
Remarks
Note
GravityAndHeading requires location services to be enabled and the user must grant your app permission to use location services. You must therefore provide a Location Usage Description entry in the Player Settings.
sessionDelegate
The ARKitSessionDelegate to use for session-related callbacks.
Declaration
public ARKitSessionDelegate sessionDelegate { get; set; }
Property Value
Type | Description |
---|---|
ARKitSessionDelegate |
supportsCollaboration
True if collaboration is supported. Collaboration is only supported on iOS versions 13.0 and later.
Declaration
public static bool supportsCollaboration { get; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
worldMappingStatus
Get the world mapping status. Used to determine the suitability of the current session for creating an ARWorldMap.
Declaration
public ARWorldMappingStatus worldMappingStatus { get; }
Property Value
Type | Description |
---|---|
ARWorldMappingStatus | The ARWorldMappingStatus of the session. |
worldMapSupported
Detect ARWorldMap support. ARWorldMap
requires iOS 12 or greater.
Declaration
public static bool worldMapSupported { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
See Also
Methods
ApplyWorldMap(ARWorldMap)
Applies an ARWorldMap to the session.
Declaration
public void ApplyWorldMap(ARWorldMap worldMap)
Parameters
Type | Name | Description |
---|---|---|
ARWorldMap | worldMap | An ARWorldMap with which to relocalize the session. |
Remarks
This attempts to relocalize the current session to the given worldMap
. If
relocalization is successful, the stored planes and anchors from the worldMap
are
added to the current session. This is equivalent to setting the
initialWorldMap
property on the session's
ARWorldTrackingConfiguration.
If worldMap
is not valid, this method sets the
initialWorldMap
configuration property to nil
.
DequeueCollaborationData()
Dequeues the oldest collaboration data in the queue. After calling this method, collaborationDataCount will be decremented by one.
Declaration
public ARCollaborationData DequeueCollaborationData()
Returns
Type | Description |
---|---|
ARCollaborationData | The nextx ARCollaborationData in the queue. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | Thrown if supportsCollaboration is false. |
InvalidOperationException | Thrown if collaborationDataCount is zero. |
See Also
GetARWorldMapAsync()
Asynchronously create an ARWorldMap. An ARWorldMap
represents the state of the session and can be serialized to a byte
array to persist the session data, or send it to another device for
shared AR experiences.
It is a wrapper for ARKit's ARWorldMap.
Declaration
public ARWorldMapRequest GetARWorldMapAsync()
Returns
Type | Description |
---|---|
ARWorldMapRequest | An ARWorldMapRequest which can be used to determine the status
of the request and get the |
See Also
GetARWorldMapAsync(Action<ARWorldMapRequestStatus, ARWorldMap>)
Asynchronously create an ARWorldMap. An ARWorldMap
represents the state of the session and can be serialized to a byte
array to persist the session data, or send it to another device for
shared AR experiences.
It is a wrapper for ARKit's ARWorldMap.
If the ARWorldMapRequestStatus is Success, then the resulting ARWorldMap must be disposed to avoid leaking native resources. Otherwise, the ARWorldMap is not valid, and need not be disposed.
Declaration
public void GetARWorldMapAsync(Action<ARWorldMapRequestStatus, ARWorldMap> onComplete)
Parameters
Type | Name | Description |
---|---|---|
Action<ARWorldMapRequestStatus, ARWorldMap> | onComplete | A method to invoke when the world map has either been created, or if the world map could not be created. Check the value of the ARWorldMapRequestStatus parameter to determine whether the world map was successfully created. |
See Also
OnCreate()
Invoked when the subsystem is created.
Declaration
protected override void OnCreate()
SetCoachingActive(Boolean, ARCoachingOverlayTransition)
Activates or deactivates the Coaching Overlay.
Declaration
public void SetCoachingActive(bool active, ARCoachingOverlayTransition transition)
Parameters
Type | Name | Description |
---|---|---|
Boolean | active | Whether the coaching overlay should be active. |
ARCoachingOverlayTransition | transition | The type of transition to use when showing or hiding the coaching overlay. |
UpdateWithCollaborationData(ARCollaborationData)
Applies ARCollaborationData to the session.
Declaration
public void UpdateWithCollaborationData(ARCollaborationData collaborationData)
Parameters
Type | Name | Description |
---|---|---|
ARCollaborationData | collaborationData | The ARCollaborationData to apply to the session. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | Thrown if supportsCollaboration is false. |
InvalidOperationException | Thrown if |