Class ARMeshManager
A manager for triangle meshes generated by an AR device. Creates, updates, and removes GameObjects in response to the environment. For each mesh, a meshPrefab is instantiated which must contain at least a MeshFilter. If the meshPrefab's GameObject also has a MeshCollider, then a physics mesh is generated asynchronously, without blocking the main thread.
Inherited Members
Namespace: UnityEngine.XR.ARFoundation
Assembly: Unity.XR.ARFoundation.dll
Syntax
[DefaultExecutionOrder(-2147483647)]
[DisallowMultipleComponent]
[AddComponentMenu("XR/AR Foundation/AR Mesh Manager")]
public class ARMeshManager : MonoBehaviour
Remarks
Related information: AR Mesh Manager component
Fields
meshInfosChanged
Invoked whenever meshes have changed (been added, updated, or removed).
Declaration
public UnityEvent<ARMeshInfosChangedEventArgs> meshInfosChanged
Field Value
Type | Description |
---|---|
UnityEvent<ARMeshInfosChangedEventArgs> |
Properties
colors
If true
, requests a color value for each vertex in generated meshes.
Declaration
public bool colors { get; set; }
Property Value
Type | Description |
---|---|
bool |
concurrentQueueSize
The number of meshes to process concurrently. Meshes are processed on a background thread. Higher numbers will require additional CPU time.
Declaration
public int concurrentQueueSize { get; set; }
Property Value
Type | Description |
---|---|
int |
density
The density of the generated mesh [0..1]. 1 will be densely tessellated, while 0 will have the lowest supported tessellation.
Declaration
public float density { get; set; }
Property Value
Type | Description |
---|---|
float |
meshPrefab
A Prefab to be instantiated for each generated mesh. The Prefab must have at least a
MeshFilter component on it.
If it also has a MeshCollider
component, the physics bounding volume data will be generated asynchronously. This does not block the
main thread, but might take longer to process.
Declaration
public MeshFilter meshPrefab { get; set; }
Property Value
Type | Description |
---|---|
MeshFilter |
meshes
Returns a collection of MeshFilters that represents meshes generated by this component.
Declaration
public IList<MeshFilter> meshes { get; }
Property Value
Type | Description |
---|---|
IList<MeshFilter> |
normals
If true
, requests a normal for each vertex in generated meshes.
Declaration
public bool normals { get; set; }
Property Value
Type | Description |
---|---|
bool |
subsystem
The XRMeshSubsystem used by this component to generate meshes.
Declaration
public XRMeshSubsystem subsystem { get; }
Property Value
Type | Description |
---|---|
XRMeshSubsystem |
tangents
If true
, requests a tangent for each vertex in generated meshes.
Declaration
public bool tangents { get; set; }
Property Value
Type | Description |
---|---|
bool |
textureCoordinates
If true
, requests a texture coordinate for each vertex in generated meshes.
Declaration
public bool textureCoordinates { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
DestroyAllMeshes()
Destroys all generated meshes and ignores any pending meshes.
Declaration
public void DestroyAllMeshes()
Events
meshesChanged
Invoked whenever meshes have changed (been added, updated, or removed).
Declaration
[Obsolete("meshesChanged is deprecated in AR Foundation 6.4. Use meshInfosChanged instead")]
public event Action<ARMeshesChangedEventArgs> meshesChanged
Event Type
Type | Description |
---|---|
Action<ARMeshesChangedEventArgs> |