I’m just learning about meshes, and I have problems understanding how they work. As a test, I made this code :
using UnityEngine;
using System.Collections;
public class MeshScript : MonoBehaviour
{
void Start()
{
Mesh mesh = GetComponent<MeshFilter>().mesh;
int i = 0;
while (i < mesh.vertices.Length)
{
mesh.vertices[i] = new Vector3(0,0,0);
i++;
}
}
}
And put this code in a cube . What I expected it to do was set all the vertices of the cube mesh to (0,0,0), making the cube disappear. However, the cube still appears, unchanged, in my game. What am I doing wrong ?
Thank you
Tabc3dd