Class ARFaceManager
Creates, updates, and removes GameObjects with ARFace components under the
XROrigin's TrackablesParent.
Inheritance
Implements
Inherited Members
Namespace: UnityEngine.XR.ARFoundation
Assembly: Unity.XR.ARFoundation.dll
Syntax
[RequireComponent(typeof(XROrigin))]
[DisallowMultipleComponent]
[DefaultExecutionOrder(-2147483647)]
[AddComponentMenu("XR/AR Foundation/AR Face Manager")]
public sealed class ARFaceManager : ARTrackableManager<XRFaceSubsystem, XRFaceSubsystemDescriptor, XRFaceSubsystem.Provider, XRFace, ARFace>, ITrackablesChanged<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.
Related information: AR Face Manager component
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
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 an 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
[Obsolete("OnTrackablesChanged() has been deprecated in AR Foundation version 6.0.", false)]
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 ARFace if found. |
Events
facesChanged
Raised for each new ARFace detected in the environment.
Declaration
[Obsolete("facesChanged has been deprecated in AR Foundation version 6.0. Use trackablesChanged instead.", false)]
public event Action<ARFacesChangedEventArgs> facesChanged
Event Type
| Type | Description |
|---|---|
| Action<ARFacesChangedEventArgs> |