Class XRFaceSubsystem.Provider
Class to be implemented by an implementor of the XRFaceSubsystem.
Inherited Members
Namespace: UnityEngine.XR.ARSubsystems
Assembly: Unity.XR.ARSubsystems.dll
Syntax
public abstract class XRFaceSubsystem.Provider : SubsystemProvider<XRFaceSubsystem>
Properties
currentMaximumFaceCount
Gets the maximum number of faces the provider will track.
Declaration
public virtual int currentMaximumFaceCount { get; }
Property Value
Type | Description |
---|---|
int |
requestedMaximumFaceCount
Get or set the maximum number of faces the subsystem should attempt to track simultaneously. Defaults to 1.
Declaration
public virtual int requestedMaximumFaceCount { get; set; }
Property Value
Type | Description |
---|---|
int |
Exceptions
Type | Condition |
---|---|
NotSupportedException | Thrown if the requested maximum face count is greater than one, but the subsystem does not support tracking multiple faces. |
supportedFaceCount
Should return the maximum number of faces the subsystem is able to track simultaneously. Defaults to 1.
Declaration
public virtual int supportedFaceCount { get; }
Property Value
Type | Description |
---|---|
int |
Methods
GetChanges(XRFace, Allocator)
Get the changes to faces (added, updated, and removed) since the last call to GetChanges(XRFace, Allocator).
Declaration
public abstract TrackableChanges<XRFace> GetChanges(XRFace defaultFace, Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
XRFace | defaultFace | The default face. This should be used to initialize the returned |
Allocator | allocator | An |
Returns
Type | Description |
---|---|
TrackableChanges<XRFace> | TrackableChanges<T> describing the faces that have been added, updated, and removed
since the last call to GetChanges(XRFace, Allocator). The changes should be allocated using
|
GetFaceMesh(TrackableId, Allocator, ref XRFaceMesh)
Get the mesh data associated with the face with faceId
. The faceMesh
should be reused if it is the correct size; otherwise, its arrays should be reallocated with allocator
.
Use Resize(int, int, Attributes, Allocator) to resize the containers for face mesh data.
Declaration
public virtual void GetFaceMesh(TrackableId faceId, Allocator allocator, ref XRFaceMesh faceMesh)
Parameters
Type | Name | Description |
---|---|---|
TrackableId | faceId | The TrackableId for a XRFace. |
Allocator | allocator | The allocator to use for the returned data if a resize is necessary. |
XRFaceMesh | faceMesh | The container for the mesh data to either re-use or re-allocate. |
Examples
var vertices = faceMesh.vertices;
CreateOrResizeNativeArrayIfNecessary(numVertices, allocator, ref vertices);
...
faceMesh.Assign(new XRFaceMesh
{
vertices = vertices,
indices = ...
});