Version: 2017.1

Mesh.GetIndices

Switch to Manual
public void GetIndices (List<int> indices, int submesh);
public int[] GetIndices (int submesh);

Parameters

indices A list of indices to populate.
submesh The sub mesh on this instance. See subMeshCount.

Description

Gets the index buffer for the specified sub mesh on this instance.

Each element value in the returned index buffer refers to a vertex index, which can be used to index into the results of other accessors like vertices and GetVertices. The layout of the indices depends on the topology of the sub mesh. For example, a triangular mesh will return indices in multiples of three.

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

Call the method overload with a List<int> parameter if you control the life cycle of the index buffer and wish to avoid allocation of a new array with every access.

See Also: subMeshCount, GetTopology, MeshTopology enum.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961