public Vector2[] uv ;

Description

网格的基础纹理坐标。


using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Start() { Mesh mesh = GetComponent<MeshFilter>().mesh; Vector3[] vertices = mesh.vertices; Vector2[] uvs = new Vector2[vertices.Length];

for (int i = 0; i < uvs.Length; i++) { uvs[i] = new Vector2(vertices[i].x, vertices[i].z); } mesh.uv = uvs; } }

注意:纹理坐标必须在网格进行修改或 创建。在上面的脚本示例中,UV 创建为新数组,然后将 纹理坐标分配给该数组。分配这些坐标后, 该数组即可分配给 Mesh