Face tracking platform support
The AR Foundation XRFaceSubsystem is supported on the ARCore and ARKit platforms, as shown in the following table:
Provider plug-in | Face tracking supported | Provider documentation |
---|---|---|
Google ARCore XR Plug-in | Yes | Face tracking (ARCore) |
Apple ARKit XR Plug-in | Yes | Face tracking (ARKit) |
Apple visionOS XR Plug-in | ||
Microsoft HoloLens | ||
Unity OpenXR: Meta | ||
XR Simulation |
Check for face tracking support
Your app can check at runtime whether a provider plug-in supports face tracking on the user's device. Use the following example code to check whether the device supports face components:
void Start()
{
if (LoaderUtility
.GetActiveLoader()?
.GetLoadedSubsystem<XRFaceSubsystem>() != null)
{
// XRFaceSubsystem was loaded. The platform supports face detection.
}
}
Note
This example code assumes that your app has already initialized XR.
By default XR initializes automatically when your app starts, but this is configurable via Project Settings > XR Plug-in Management > Initialize XR on Startup. Refer to the XR Plug-in Management End-user documentation for more detailed information about managing the XR Plug-in lifecycle.
Optional features
The following table lists the optional features of the face subsystem. Each optional feature is defined by a Descriptor Property of the XRFaceSubsystemDescriptor, which you can check at runtime to determine whether a feature is supported. Refer to Check for optional feature support for a code example to check whether a feature is supported.
Feature | Descriptor Property | Description |
---|---|---|
Face pose | supportsFacePose | Whether the subsystem can produce a Pose for each detected face. |
Face mesh vertices and indices | supportsFaceMeshVerticesAndIndices | Whether the subsystem supports face meshes and can produce vertices and triangle indices that represent a face mesh. |
Face mesh UVs | supportsFaceMeshUVs | Whether the subsystem supports texture coordinates for each face mesh. |
Face mesh normals | supportsFaceMeshNormals | Whether the subsystem supports normals for each face mesh. |
Eye tracking | supportsEyeTracking | Whether the subsystem supports eye tracking for each detected face. |
Optional feature platform support
The following table lists whether certain XR plug-in providers support each optional feature:
Feature | ARCore | ARKit |
---|---|---|
Face pose | Yes | Yes |
Face mesh vertices and indices | Yes | Yes |
Face mesh UVs | Yes | Yes |
Face mesh normals | Yes | |
Eye tracking | Yes |
Check for optional feature support
Your app can check at runtime whether a face tracking provider supports any optional features on the user's device. The XRFaceSubsystemDescriptor contains Boolean properties for each optional feature that tell you whether they are supported.
Refer to the following example code to learn how to check for optional feature support:
void CheckForOptionalFeatureSupport()
{
// This is inefficient. You should re-use a saved reference instead.
var manager = Object.FindAnyObjectByType<ARFaceManager>();
// Use manager.descriptor to determine which optional features
// are supported on the device. For example:
if (manager.descriptor.supportsFacePose)
{
// Face pose is supported.
}
}
Apple and ARKit are trademarks of Apple Inc., registered in the U.S. and other countries and regions.