how to: create a four vertex, two tri square polygon in Unity Editor or Script?

The plane object has WAY to many tris/verts for what I want. And I can't manipulate the verts. Or delete some of them.

You can create a new Mesh like so:

using UnityEngine;

[RequireComponent(typeof(MeshRenderer)), RequireComponent(typeof(MeshFilter))]
public class CreatePlaneMeshExample : MonoBehaviour
    void Start()
        GetComponent<MeshFilter>().mesh = CreatePlaneMesh();

    Mesh CreatePlaneMesh()
        Mesh mesh = new Mesh();

        Vector3[] vertices = new Vector3[]
            new Vector3( 1, 0,  1),
            new Vector3( 1, 0, -1),
            new Vector3(-1, 0,  1),
            new Vector3(-1, 0, -1),

        Vector2[] uv = new Vector2[]
            new Vector2(1, 1),
            new Vector2(1, 0),
            new Vector2(0, 1),
            new Vector2(0, 0),

        int[] triangles = new int[]
            0, 1, 2,
            2, 1, 3,

        mesh.vertices = vertices;
        mesh.uv = uv;
        mesh.triangles = triangles;

        return mesh;

You can create one in a modeling program and import it. Or, you can write code (or use existing code) to create a 'quad' mesh procedurally.

I think there's a 'create plane mesh' script on the script wiki that allows you to specify the subdivision level, so you might look for that. If you get stuck though, post back (I have a script lying around somewhere that should do just what you're wanting).

[Drat...thwarted by a complete example! :)]

[@The OP: Note however that the above code will create a mesh procedurally at run time. If you just want a mesh model or quad prefab that can be shared between scenes/game objects, that can be done as well. (I have a 'quad' prefab that was generated this way that I use for sprites and that sort of thing.)]

This script seems to be the most effective way to create a simple plane without having to bother with a 3d Editor:


Old thread but the Quad is 2 polygons for anyone who comes across this.