What if you could build any 3D object with just a few lines of code instead of drawing every point by hand?
Why Mesh and mesh renderer in Unity? - Purpose & Use Cases
Imagine you want to create a 3D model of a simple cube by placing each point and connecting lines manually in your game scene.
You try to draw every corner and face by hand, adjusting each vertex and edge one by one.
This manual method is slow and frustrating because you must calculate every point's position and how they connect.
It's easy to make mistakes, like missing a face or connecting points incorrectly, which breaks the shape.
Also, updating or changing the shape means redoing many steps, wasting time and effort.
Using a mesh and mesh renderer lets you define the shape by listing points (vertices) and how they connect (triangles) in a simple way.
The mesh renderer then takes care of drawing the shape on screen with materials and lighting automatically.
This approach saves time, reduces errors, and makes it easy to create or change complex 3D objects.
Vector3 p1 = new Vector3(0,0,0); Vector3 p2 = new Vector3(1,0,0); // Manually draw lines between points
Mesh mesh = new Mesh();
mesh.vertices = new Vector3[] {new Vector3(0,0,0), new Vector3(1,0,0), new Vector3(1,1,0), new Vector3(0,1,0)};
mesh.triangles = new int[] {0,1,2, 2,3,0};
GetComponent<MeshFilter>().mesh = mesh;It enables you to create and display any 3D shape efficiently, from simple cubes to complex characters, with full control over appearance.
Game developers use meshes and mesh renderers to build characters, environments, and objects that players see and interact with in 3D worlds.
Manual 3D shape creation is slow and error-prone.
Meshes define shapes by vertices and triangles, simplifying creation.
Mesh renderers display these shapes with materials and lighting automatically.