Version: 2020.3

Mesh.GetVertexAttributes

매뉴얼로 전환
public VertexAttributeDescriptor[] GetVertexAttributes ();

반환

VertexAttributeDescriptor[] Array of vertex attribute information.

설명

Get information about vertex attributes of a Mesh.

Many of mesh vertex data attributes are optional, for example a mesh might contain only vertex positions, normals and one UV coordinate. Each attribute might use a different data type for storage. Use this function to query information about all attributes that describe vertices of this Mesh.

The returned array contains as many elements as there are vertex attributes. For example, if a Mesh has position and normals set up, but no other attributes, then the returned array will have two elements (one describing position, the other describing normal).

See Also: VertexAttributeDescriptor, HasVertexAttribute, SetVertexBufferParams.


public int GetVertexAttributes (VertexAttributeDescriptor[] attributes);
public int GetVertexAttributes (List<VertexAttributeDescriptor> attributes);

파라미터

attributes Collection of vertex attributes to receive the results.

반환

int The number of vertex attributes returned in the attributes container.

설명

Get information about vertex attributes of a Mesh, without memory allocations.

Use these overloads of the GetVertexAttributes function to avoid having to allocate a new array each time the function is called. The List variant only allocates memory if the list does not have enough capacity to hold all the vertex attributes. The array variant never allocates memory; if the array is too small then only a part of all the vertex attributes is returned.

Alternative way to query vertex attributes that does not need any memory allocations at all, is to use vertexAttributeCount and GetVertexAttribute functions.

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