Class ARFaceManager
Creates, updates, and removes GameObject
s with ARFace components under the
Unity.XR.CoreUtils.XROrigin's Unity.XR.CoreUtils.XROrigin.TrackablesParent.
Inheritance
Inherited Members
Namespace: UnityEngine.XR.ARFoundation
Assembly: Unity.XR.ARFoundation.dll
Syntax
[RequireComponent(typeof(XROrigin))]
[DisallowMultipleComponent]
[DefaultExecutionOrder(-2147483647)]
public sealed class ARFaceManager : ARTrackableManager<XRFaceSubsystem, XRFaceSubsystemDescriptor, XRFaceSubsystem.Provider, XRFace, ARFace>
Remarks
When enabled, this component subscribes to facesChanged event to update face data. If this component is disabled, and there are no other subscribers to those events, face detection will be disabled on the device.
Properties
currentMaximumFaceCount
Get the maximum number of faces to track simultaneously.
Declaration
public int currentMaximumFaceCount { get; }
Property Value
Type | Description |
---|---|
int |
facePrefab
Getter/setter for the Face Prefab.
Declaration
public GameObject facePrefab { get; set; }
Property Value
Type | Description |
---|---|
GameObject |
gameObjectName
The name assigned to each GameObject
belonging to each ARFace.
Declaration
protected override string gameObjectName { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
maximumFaceCount
Get or set the maximum number of faces to track simultaneously. This method is obsolete. Use currentMaximumFaceCount or requestedMaximumFaceCount instead.
Declaration
[Obsolete("Use requestedMaximumFaceCount or currentMaximumFaceCount instead. (2020-01-14)")]
public int maximumFaceCount { get; set; }
Property Value
Type | Description |
---|---|
int |
requestedMaximumFaceCount
Get or set the requested maximum number of faces to track simultaneously
Declaration
public int requestedMaximumFaceCount { get; set; }
Property Value
Type | Description |
---|---|
int |
supportedFaceCount
Get the supported number of faces that can be tracked simultaneously. This value might change when the configuration changes.
Declaration
public int supportedFaceCount { get; }
Property Value
Type | Description |
---|---|
int |
Methods
GetPrefab()
Get the Prefab that will be instantiated for each ARFace. Can be null
.
Declaration
protected override GameObject GetPrefab()
Returns
Type | Description |
---|---|
GameObject | The prefab that will be instantiated for each ARFace. |
Overrides
OnAfterSetSessionRelativeData(ARFace, XRFace)
Invoked just after a ARFace has been updated.
Declaration
protected override void OnAfterSetSessionRelativeData(ARFace face, XRFace sessionRelativeData)
Parameters
Type | Name | Description |
---|---|---|
ARFace | face | |
XRFace | sessionRelativeData |
Overrides
OnBeforeStart()
Invoked just before calling Start
on the Subsystem. Used to set the requestedMaximumFaceCount
on the subsystem.
Declaration
protected override void OnBeforeStart()
Overrides
OnTrackablesChanged(List<ARFace>, List<ARFace>, List<ARFace>)
Invoked when the base class detects trackable changes.
Declaration
protected override void OnTrackablesChanged(List<ARFace> added, List<ARFace> updated, List<ARFace> removed)
Parameters
Type | Name | Description |
---|---|---|
List<ARFace> | added | The list of added ARFaces. |
List<ARFace> | updated | The list of updated ARFaces. |
List<ARFace> | removed | The list of removed ARFaces. |
Overrides
TryGetFace(TrackableId)
Attempts to retrieve an ARFace.
Declaration
public ARFace TryGetFace(TrackableId faceId)
Parameters
Type | Name | Description |
---|---|---|
TrackableId | faceId | The |
Returns
Type | Description |
---|---|
ARFace | The ARFaceif found. |
Events
facesChanged
Raised for each new ARFace detected in the environment.
Declaration
public event Action<ARFacesChangedEventArgs> facesChanged
Event Type
Type | Description |
---|---|
Action<ARFacesChangedEventArgs> |