Class ARMeshManager
A manager for triangle meshes generated by an AR device.
Creates, updates, and removes GameObject
s 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
Syntax
[DefaultExecutionOrder(-2147483647)]
[DisallowMultipleComponent]
[HelpURL("https://docs.unity.cn/Packages/com.unity.xr.arfoundation@4.2/api/UnityEngine.XR.ARFoundation.ARMeshManager.html")]
public class ARMeshManager : MonoBehaviour
Properties
colors
If true
, requests a color value for each vertex in generated meshes.
Declaration
public bool colors { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
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 |
---|---|
Int32 |
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 |
---|---|
Single |
meshes
Returns a collection of MeshFilter
s
that represents meshes generated by this component.
Declaration
public IList<MeshFilter> meshes { get; }
Property Value
Type | Description |
---|---|
IList<MeshFilter> |
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 |
normals
If true
, requests a normal for each vertex in generated meshes.
Declaration
public bool normals { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
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 |
---|---|
Boolean |
textureCoordinates
If true
, requests a texture coordinate for each vertex in generated meshes.
Declaration
public bool textureCoordinates { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
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
public event Action<ARMeshesChangedEventArgs> meshesChanged
Event Type
Type | Description |
---|---|
Action<ARMeshesChangedEventArgs> |