ApplyAndDisposeWritableMeshData
Applies data defined in MeshData structs to Mesh objects.
Read time 3 minutesLast updated 10 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
ApplyAndDisposeWritableMeshData(MeshDataArray, Mesh, MeshUpdateFlags)
Applies data defined in structs to Mesh objects.
MeshDatapublic static void ApplyAndDisposeWritableMeshData(Mesh.MeshDataArray data, Mesh mesh, MeshUpdateFlags flags = MeshUpdateFlags.Default)
Parameters
The mesh data array, see Mesh.MeshDataArray.
The destination Mesh. Mesh data array must be of size 1.
The mesh data update flags, see MeshUpdateFlags.
Remarks
ApplyAndDisposeWritableMeshData takes a Mesh.MeshDataArray containing writeable structs, and applies the vertex buffer, index buffer, and sub-mesh data to Mesh objects. Use this to create new Meshes using the C# Job System and Burst.
MeshDataAfter is called, the struct is disposed and can no longer be used.
ApplyAndDisposeWritableMeshDataMeshDataArrayUsing this method, Unity performs very little data validation, so you must ensure your data is valid. In particular, you must ensure that the sub-mesh index range and topology are set to correct values. Sub-mesh indices, both indexStart and indexCount from SubMeshDescriptor, must not overlap with any other sub-mesh indices.
When using Mesh LODs, you must also ensure that the provided index range for each of the sub-meshes is large enough to contain all levels of detail used within that sub-mesh. You can disable validation by setting flags to MeshUpdateFlags.DontValidateLodRanges.
ApplyAndDisposeWritableMeshData(MeshDataArray, Mesh[], MeshUpdateFlags)
Applies data defined in structs to Mesh objects.
MeshDatapublic static void ApplyAndDisposeWritableMeshData(Mesh.MeshDataArray data, Mesh[] meshes, MeshUpdateFlags flags = MeshUpdateFlags.Default)
Parameters
The mesh data array, see Mesh.MeshDataArray.
The destination Meshes. Must match the size of mesh data array.
The mesh data update flags, see MeshUpdateFlags.
Remarks
ApplyAndDisposeWritableMeshData takes a Mesh.MeshDataArray containing writeable structs, and applies the vertex buffer, index buffer, and sub-mesh data to Mesh objects. Use this to create new Meshes using the C# Job System and Burst.
MeshDataAfter is called, the struct is disposed and can no longer be used.
ApplyAndDisposeWritableMeshDataMeshDataArrayUsing this method, Unity performs very little data validation, so you must ensure your data is valid. In particular, you must ensure that the sub-mesh index range and topology are set to correct values. Sub-mesh indices, both indexStart and indexCount from SubMeshDescriptor, must not overlap with any other sub-mesh indices.
When using Mesh LODs, you must also ensure that the provided index range for each of the sub-meshes is large enough to contain all levels of detail used within that sub-mesh. You can disable validation by setting flags to MeshUpdateFlags.DontValidateLodRanges.
ApplyAndDisposeWritableMeshData(MeshDataArray, List<Mesh>, MeshUpdateFlags)
Applies data defined in structs to Mesh objects.
MeshDatapublic static void ApplyAndDisposeWritableMeshData(Mesh.MeshDataArray data, List<Mesh> meshes, MeshUpdateFlags flags = MeshUpdateFlags.Default)
Parameters
The mesh data array, see Mesh.MeshDataArray.
The destination Meshes. Must match the size of mesh data array.
The mesh data update flags, see MeshUpdateFlags.
Remarks
ApplyAndDisposeWritableMeshData takes a Mesh.MeshDataArray containing writeable structs, and applies the vertex buffer, index buffer, and sub-mesh data to Mesh objects. Use this to create new Meshes using the C# Job System and Burst.
MeshDataAfter is called, the struct is disposed and can no longer be used.
ApplyAndDisposeWritableMeshDataMeshDataArrayUsing this method, Unity performs very little data validation, so you must ensure your data is valid. In particular, you must ensure that the sub-mesh index range and topology are set to correct values. Sub-mesh indices, both indexStart and indexCount from SubMeshDescriptor, must not overlap with any other sub-mesh indices.
When using Mesh LODs, you must also ensure that the provided index range for each of the sub-meshes is large enough to contain all levels of detail used within that sub-mesh. You can disable validation by setting flags to MeshUpdateFlags.DontValidateLodRanges.