unity define mesh code example
Example: unity mesh
using UnityEngine;
using UnityEditor;
public class mesh
{
void Start()
{
Mesh m = new Mesh();
m.verticies = new Vector3[]//for each polygon you have to make a new verticie
{
new Vector3(0, 0, 0),
new Vector3(1, 0, 0),
new Vector3(1, 0, 1),
new Vector3(1, 1, 1),
new Vector3(1, 0, 0),
new Vector3(1, 0, 1)
};
m.triangles = new int[]{0, 1, 2, 3, 5, 4};
m.RecalculateNormals();
transform.GetComponent<MeshRenderer>().mesh = m;
}
}