Version: 2017.3

Mesh.GetTriangles

切换到手册
public int[] GetTriangles (int submesh);
public int[] GetTriangles (int submesh, bool applyBaseVertex= true);
public void GetTriangles (List<int> triangles, int submesh, bool applyBaseVertex= true);
public void GetTriangles (List<int> triangles, int submesh);

参数

triangles 要填充的顶点索引的列表。
submesh The sub mesh on this instance. See subMeshCount.
applyBaseVertex True (default) value will apply base vertex offset to returned indices.

描述

Gets the triangle list for the specified sub mesh on this instance.

Each element value in the returned triangle list refers to a vertex index, which can be used to index into the results of other accessors like vertices and GetVertices. It will return indices in multiples of three.

A sub mesh is simply a separate triangle list. When the mesh is rendered using multiple materials, you should ensure that there is one sub mesh per Material.

如果要控制索引缓冲区的生命周期并且需要避免在每次访问时都分配新数组,请使用 List<int> 参数调用方法重载。

另请参阅:subMeshCount