uv终于贴对了,贴上代码void Start() { Mesh mesh = GetComponent()?.mesh; if (mesh == null || me...
uv终于贴对了,贴上代码
void Start()
{
Mesh mesh = GetComponent()?.mesh;
if (mesh == null || mesh.uv.Length != 24)
{
Debug.Log("Attach To Cube");
return;
}
Vector2[] meshUV = mesh.uv;
meshUV[0] = new Vector2(0f, 0f);
meshUV[1] = new Vector2(0.333f, 0f);
meshUV[2] = new Vector2(0f, 0.333f);
meshUV[3] = new Vector2(0.333f, 0.333f);
meshUV[8] = new Vector2(0.334f, 0f);
meshUV[9] = new Vector2(0.666f, 0f);
meshUV[4] = new Vector2(0.334f, 0.333f);
meshUV[5] = new Vector2(0.666f, 0.333f);
meshUV[10] = new Vector2(0.667f, 0f);
meshUV[11] = new Vector2(1f, 0f);
meshUV[6] = new Vector2(0.667f, 0.333f);
meshUV[7] = new Vector2(1f, 0.333f);
meshUV[12] = new Vector2(0f, 0.334f);
meshUV[15] = new Vector2(0.333f, 0.334f);
meshUV[13] = new Vector2(0f, 0.666f);
meshUV[14] = new Vector2(0.333f, 0.666f);
meshUV[16] = new Vector2(0.334f, 0.334f);
meshUV[19] = new Vector2(0.666f, 0.334f);
meshUV[17] = new Vector2(0.334f, 0.666f);
meshUV[18] = new Vector2(0.666f, 0.666f);
meshUV[20] = new Vector2(0.667f, 0.334f);
meshUV[21] = new Vector2(0.667f, 0.666f);
meshUV[23] = new Vector2(1f, 0.334f);
meshUV[22] = new Vector2(1f, 0.667f);
mesh.uv = meshUV;
}
void Start()
{
Mesh mesh = GetComponent()?.mesh;
if (mesh == null || mesh.uv.Length != 24)
{
Debug.Log("Attach To Cube");
return;
}
Vector2[] meshUV = mesh.uv;
meshUV[0] = new Vector2(0f, 0f);
meshUV[1] = new Vector2(0.333f, 0f);
meshUV[2] = new Vector2(0f, 0.333f);
meshUV[3] = new Vector2(0.333f, 0.333f);
meshUV[8] = new Vector2(0.334f, 0f);
meshUV[9] = new Vector2(0.666f, 0f);
meshUV[4] = new Vector2(0.334f, 0.333f);
meshUV[5] = new Vector2(0.666f, 0.333f);
meshUV[10] = new Vector2(0.667f, 0f);
meshUV[11] = new Vector2(1f, 0f);
meshUV[6] = new Vector2(0.667f, 0.333f);
meshUV[7] = new Vector2(1f, 0.333f);
meshUV[12] = new Vector2(0f, 0.334f);
meshUV[15] = new Vector2(0.333f, 0.334f);
meshUV[13] = new Vector2(0f, 0.666f);
meshUV[14] = new Vector2(0.333f, 0.666f);
meshUV[16] = new Vector2(0.334f, 0.334f);
meshUV[19] = new Vector2(0.666f, 0.334f);
meshUV[17] = new Vector2(0.334f, 0.666f);
meshUV[18] = new Vector2(0.666f, 0.666f);
meshUV[20] = new Vector2(0.667f, 0.334f);
meshUV[21] = new Vector2(0.667f, 0.666f);
meshUV[23] = new Vector2(1f, 0.334f);
meshUV[22] = new Vector2(1f, 0.667f);
mesh.uv = meshUV;
}