Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MeshFilter meshFilter = AddComponent<MeshFilter>();
- Mesh mesh = new Mesh();
- Vector3[] verts = new Vector3[] {
- new Vector3(0, 0, 0),
- new Vector3(1, 0, 0),
- new Vector3(1, 0, 1),
- new Vector3(0, 0, 1)
- };
- int[] tris = new int[] { 0, 2, 1, 3, 2, 0 };
- Vector2[] uv1s = new Vector2[] {
- new Vector2(0, 0),
- new Vector2(1, 0),
- new Vector2(1, 1),
- new Vector2(0, 1)
- };
- // Assign mesh properties
- mesh.vertices = verts;
- mesh.uv = uv1s;
- mesh.triangles = tris;
- mesh.RecalculateNormals();
- mesh.RecalculateBounds();
- meshFilter.mesh = planeMesh;
Advertisement
Add Comment
Please, Sign In to add comment