To attempt to get a triangle showing procedurally, I did the following.
Start a new instance of Unity.
Create a new GameObject in the hierarchy to hold the triangle.
Added a MeshFilter and MeshRenderer to the GameObject.
Created a C# Script in Assets and added this code to the Start function:
Mesh mesh = newMesh();
mesh.vertices = newVector3[3];
mesh.vertices[0] = newVector3(0, 0, 0);
mesh.vertices[1] = newVector3(0, 1, 0);
mesh.vertices[2] = newVector3(1, 0, 0);
mesh.normals = newVector3[3];
mesh.normals[0] = newVector3(0, 0, -1);
mesh.normals[1] = newVector3(0, 0, -1);
mesh.normals[2] = newVector3(0, 0, -1);
mesh.uv = newVector2[3];
mesh.uv[0] = newVector2(0, 0);
mesh.uv[1] = newVector2(0, 1);
mesh.uv[2] = newVector2(1, 0);
mesh.triangles = newint[3];
mesh.triangles[0] = 0;
mesh.triangles[1] = 1;
mesh.triangles[2] = 2;
mesh.RecalculateBounds();
MeshFilter filter = GetComponent();
if (filter != null)
{
filter.sharedMesh = mesh;
}
Dragged the script onto the GameObject to hook it up.
Pressed play.
No triangle. Where is the $%^& triangle.