Version: 2022.3
LanguageEnglish
  • C#

Mesh.MeshData.GetVertexAttributeDimension

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual

Declaration

public int GetVertexAttributeDimension(Rendering.VertexAttribute attr);

Parameters

attr The vertex attribute to get the dimension of.

Returns

int Returns the dimension of the vertex attribute. Returns 0 if the vertex attribute is not present.

Description

Gets the dimension of a given vertex attribute in the MeshData.

Most vertex attributes have a standard data layout. For example, a normal is a 3-component vector. Some vertex attributes (usually texture coordinates) have more than one possible data layout. For example, SetUVs accepts either 2 dimensional, 3 dimensional or 4 dimensional texture coordinates. You can use this function to query the layout of a given vertex attribute. Additional resources: HasVertexAttribute, GetVertexAttributeFormat.