Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
13 views1 page

Unity Script Reference - Mesh - Vertices

The document describes the Mesh.vertices property in Unity, which allows for retrieving and assigning vertex positions of a mesh. It explains that changing the vertex array size automatically resizes other vertex attributes and invokes RecalculateBounds if no vertices are assigned. An example script demonstrates how to modify vertex positions in local space and reassign them back to the mesh.

Uploaded by

fraserbarnes07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views1 page

Unity Script Reference - Mesh - Vertices

The document describes the Mesh.vertices property in Unity, which allows for retrieving and assigning vertex positions of a mesh. It explains that changing the vertex array size automatically resizes other vertex attributes and invokes RecalculateBounds if no vertices are assigned. An example script demonstrates how to modify vertex positions in local space and reassign them back to the mesh.

Uploaded by

fraserbarnes07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Manual Scripting API Search scripting... unity.

com

Version: Unity 6.1 (6000.1) C#

Mesh.vertices
Leave feedback
SWITCH TO MANUAL

public Vector3[] vertices;

Description
Returns a copy of the vertex positions or assigns a new vertex positions array.

The number of vertices in the Mesh is changed by assigning a vertex array with a different number of vertices.

If you resize the vertex array then all other vertex attributes (normals, colors, tangents, UVs) are automatically resized too. RecalculateBounds is automatically invoked if no vertices
have been assigned to the Mesh when setting the vertices.

Note that this method returns the vertices in local space, not in world space.

using UnityEngine;

public class Example : MonoBehaviour


{
Mesh mesh;
Vector3[] vertices;
void Start()
{
mesh = GetComponent<MeshFilter>().mesh;
vertices = mesh.vertices;
}

void Update()
{
for (var i = 0; i < vertices.Length; i++)
{
vertices[i] += Vector3.up * Time.deltaTime;
}

// assign the local vertices array into the vertices array of the Mesh.
mesh.vertices = vertices;
mesh.RecalculateBounds();
}
}

Note: To make changes to the vertices it is important to copy the vertices from the Mesh. Once the vertices have been copied and changed the vertices can be reassigned back to
the Mesh.

Did you find this page useful? Please give it a rating:

Report a problem on this page

Is something described here not working as you expect it to? It might be a Known Issue. Please check with the Issue Tracker at issuetracker.unity3d.com .

Copyright ©2005-2025 Unity Technologies. All rights reserved. Built from: 6000.1.15f1 (090817289254). Built on: 2025-07-28.

Tutorials Community Answers Knowledge Base Forums Asset Store Terms of use Legal Privacy Policy Cookies Do Not Sell or Share My Personal

Information Your Privacy Choices (Cookie Settings)

You might also like