Make mesh always face up?

I made it so a mesh is made by the player but i want it always facing up because when i create the mesh, sometimes its backwards and looks invisable because it is flat and the material is on the other side.

var floor = new GameObject("floor");
floor.AddComponent(MeshFilter);
floor.AddComponent(MeshRenderer);
var floorMesh = new Mesh();
floorMesh.name = "floorMesh";
floorMesh.vertices = [floorV1, floorV2, floorV3, floorV4];
floorMesh.triangles = [0, 2, 1, 0, 3, 2];
floorMesh.normals = [Vector3.up,Vector3.up,Vector3.up,Vector3.up];
floorMesh.uv = [Vector2(0,1),Vector2(0,0),Vector2(1,0),Vector2(1,1)];
//floor.gameObject.AddComponent(MeshCollider);
//floor.GetComponent(MeshCollider).sharedMesh = meshToCollide;
floor.GetComponent(MeshFilter).mesh = floorMesh;
floor.GetComponent(MeshRenderer).material = currentColor;

also, how do i make the colider work, because it doesnt seem to work, it gives me a error

Reverse the triangle index order: [0, 1, 2, 0, 2, 3]

You should be able to use the same mesh you created as the collider

For the collider, you should use an edgeCollider or a PolygonCollider and pass it the vertices of your mesh. (That’s what I do and it works just fine :wink: )