5.2.0b4 - SetVertices() geometry issue

When trying to setup a simple rectangle using SetVertices(), I only get a Triangle. The bottom right of the rectangle is missing. When doing the same thing in Unity 5.1, it works as expected.

        UIVertex vertex = new UIVertex ();
        vertex.color = Color.white;
        vertex.uv0 = new Vector2 (0, 0);

        // Bottom Left
        vertex.position = new Vector3 (0, 0, 0);
        vertex.uv0 = new Vector2 (0, 0);
        //vertex.color = Color.white;
        m_uiVertices [0] = vertex;

        // Top Left
        vertex.position = new Vector3 (0, 5, 0);
        vertex.uv0 = new Vector2 (0, 1);
        //vertex.color = Color.yellow;
        m_uiVertices [1] = vertex;

        // Top Right
        vertex.position = new Vector3 (5, 5, 0);
        vertex.uv0 = new Vector2 (1, 1);
        //vertex.color = Color.red;
        m_uiVertices [2] = vertex;

        // Bottom Right
        vertex.position = new Vector3 (5, 0, 0);
        vertex.uv0 = new Vector2 (1, 0);
        //vertex.color = Color.blue;
        m_uiVertices [3] = vertex;

Anyone else experiencing this behavior?

And the rest of your code? Mesh setup?

UI vertex list in 5.2 seems to be triangle lists, not quad lists as it was before.
So, maybe you will have to duplicate the vertices and send the 6 vertices that make the quad instead of just the 4 that you previously sent.
Haven’t tried sending the vertices directly to the renderer, but at least for my UI effects I had to place a condition to deal with triangle vs quad depending on the unity version.

The rest is m_CanvasRenerer.SetVertices(m_uiVertices, 4);

Which I didn’t provide given the triviality of it all.

I hope not given .SetVertices() was added back in Beta 4 to provide backwards compatibility. Requiring a different setup from previous versions of Unity 5 would defeat that purpose.

Can you give me a project that demonstrates the issue? Our internal test for this is passing, but maybe a corner case.

Here is a simple Repro Case 716597 showing this behavior.

btw- we’re also using TextMesh Pro in our project, waiting til I hear this issue is solved before I upgrade to the latest beta. Thanks for being on top of it Stephan/Tim!

I’m on it right now.

Fixed :slight_smile: getting in asap

3 Likes

Thanks Tim!

Looking forward to the next beta release :slight_smile:

Just installed Beta 6 and the triangle setup is now working correctly with .SetVertices().

However, the behavior of .SetMaterial appears to have changed where using .SetMaterial(mat, null) no longer uses the material’s “_MainTex”.

Filed a bug report and included a Repro Project for you (Case 718455)

Tim just indicated that Case 718455 has been addressed and the fix will be in the next release.

Is all this SetVertices and similar stuff only dealing with the UI or does all of this change with regular mesh objects too? I’m doing procedural generation on meshes, but not UI (not using beta right now). Should I be concerned?

Anyone? Are my questions not important enough to answer? :smile:

As far is a know the changes only affect the Canvas Renderer.

Great. Thanks.

SetVertices is on Mesh so it does affect meshes

Thanks. Are there any docs or anything on this yet so I can see what I’ll have to contend with if I move up to the beta? In this forum all I see are posts about the UI meshes.