GenerateMeshAsync
Requests the generation of the Mesh with MeshId meshId. Unity calls onMeshGenerationComplete when generation finishes.
Read time 2 minutesLast updated 10 days ago
Definition
- Type: Method
- Namespace: UnityEngine.XR
- Assembly: UnityEngine.XRModule
GenerateMeshAsync(MeshId, Mesh, MeshCollider, MeshVertexAttributes, Action<MeshGenerationResult>)
Requests the generation of the Mesh with MeshId. Unity calls when generation finishes.
meshIdonMeshGenerationCompletepublic void GenerateMeshAsync(MeshId meshId, Mesh mesh, MeshCollider meshCollider, MeshVertexAttributes attributes, Action<MeshGenerationResult> onMeshGenerationComplete)
Parameters
(Optional) The MeshCollider to populate with physics data. This may be null.
The vertex attributes you'd like to use.
The delegate to invoke when the generation completes.
Remarks
Use this method to request that a mesh is asynchronously generated. "Generation" includes extracting the mesh data from the subsystem's mesh provider (e.g., an AR device) and baking the MeshCollider (if is not null).
meshColliderThis happens in a background thread. For large meshes, this can take several frames to complete. is invoked when the generation completes.
onMeshGenerationCompleteThe mesh vertices are provided in session space.
Additional Resources: XRMeshSubsystem.TryGetMeshInfos
GenerateMeshAsync(MeshId, Mesh, MeshCollider, MeshVertexAttributes, Action<MeshGenerationResult>, MeshGenerationOptions)
Requests the generation of the Mesh with MeshId. Unity calls when generation finishes.
meshIdonMeshGenerationCompletepublic void GenerateMeshAsync(MeshId meshId, Mesh mesh, MeshCollider meshCollider, MeshVertexAttributes attributes, Action<MeshGenerationResult> onMeshGenerationComplete, MeshGenerationOptions options)
Parameters
(Optional) The MeshCollider to populate with physics data. This may be null.
The vertex attributes you'd like to use.
The delegate to invoke when the generation completes.
The mesh generation options.
Remarks
This variant allows you to specify additional mesh generation options.
Note: If the MeshGenerationOptions.ConsumeTransform flag is set in the argument, the resulting mesh will be relative to the transform provided by the MeshGenerationResult. If this flag is not set, the vertices are transformed into session space and the MeshGenerationResult will contain an identity transform.
optionsAdditional Resources: XRMeshSubsystem.TryGetMeshInfos