Version: 2017.2
public Vector3[] vertices ;

Descripción

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. Note that 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.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Update() { Mesh mesh = GetComponent<MeshFilter>().mesh; Vector3[] vertices = mesh.vertices; int i = 0; while (i < vertices.Length) { vertices[i] += Vector3.up * Time.deltaTime; i++; } 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.

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