Primitive Cube Vertices Different

I’ve been working on UV mapping within Unity for a project I’m working on and I found and used the script found here: UV mapping - Unity Answers

Now this works perfectly fine on Windows, but when I try and do the exact same thing on my Mac, things don’t work right, the texture on the sides of the cube get split ‘incorrectly’.

In this code:

private Vector2[] theUVs;

void Start() 
{
	theMesh = transform.GetComponent<MeshFilter>().mesh;
	theUVs = new Vector2[theMesh.uv.Length];
	theUVs = theMesh.uv;

	SetUVs();
}

the array ‘theUVs’ has the same values in PC vs Mac. But in the mac version I get:
62598-screen-shot-2016-01-25-at-124022-pm.png

I can fix it here:

// OLD: LEFT   19   17   16   18
//theUVs[19] = new Vector2( uvsLeft.x, uvsLeft.y );
//theUVs[17] = new Vector2( uvsLeft.x + uvsLeft.width, uvsLeft.y );
//theUVs[16] = new Vector2( uvsLeft.x, uvsLeft.y - uvsLeft.height );
//theUVs[18] = new Vector2( uvsLeft.x + uvsLeft.width, uvsLeft.y - uvsLeft.height );

// LEFT   19   17   16   18
theUVs[17] = new Vector2( uvsLeft.x, uvsLeft.y );
theUVs[18] = new Vector2( uvsLeft.x + uvsLeft.width, uvsLeft.y );
theUVs[16] = new Vector2( uvsLeft.x, uvsLeft.y - uvsLeft.height );
theUVs[19] = new Vector2( uvsLeft.x + uvsLeft.width, uvsLeft.y - uvsLeft.height );

The question really is, why is it different between the two systems? Why do I have to change it?

Thanks for your help

You’re probably using DirectX on Windows, and OpenGL on Mac. They use opposite winding orders for rendering. I think Unity fixes that for you if you import a mesh, but if you generate it dynamically, you may need to manage it yourself.