- Home /
Mesh being generated with a script not showing up,My mesh isn't showing up in the scene view or the game view.
Hi I'm pretty new to code and making games so I follow tutorials a lot. I needed to make a mesh and I tried to find videos on it. I tried to create a small triangle and I got this code` public void Start() { Mesh mesh = new Mesh(); GetComponent().mesh = mesh;
Vector3[] vertices = new Vector3[3];
Vector2[] uv = new Vector2[3];
int[] triangles = new int[3];
vertices[0] = Vector3.zero;
vertices[1] = new Vector3(50, 0);
vertices[2] = new Vector3(-50, 0);
triangles[0] = 0;
triangles[1] = 1;
triangles[2] = 2;
mesh.vertices = vertices;
mesh.uv = uv;
mesh.triangles = triangles;
}
` But for some reason it's just not showing up in the game view or the scene view, can anyone help me out on this? The game is 2d.
For me, I have a 3d Planet with meshes but my player falls through the planet and when I try to add a mesh collider, the mesh/meshes are not there to add.
Your answer

Follow this Question
Related Questions
How can you ascyncronously modify mesh vertex data? 0 Answers
Problem drawing a mesh with Graphics.DrawMeshNow 1 Answer
One vertex array per submesh 2 Answers
rendering hollow mesh ? 0 Answers
3d model problem 1 Answer