Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Graphics 5.2.0b4 - SetVertices() geometry issue

Discussion in '5.2 Beta' started by Stephan-B, Jul 26, 2015.

  1. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    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.

    Code (CSharp):
    1.  
    2.         UIVertex vertex = new UIVertex ();
    3.         vertex.color = Color.white;
    4.         vertex.uv0 = new Vector2 (0, 0);
    5.  
    6.         // Bottom Left
    7.         vertex.position = new Vector3 (0, 0, 0);
    8.         vertex.uv0 = new Vector2 (0, 0);
    9.         //vertex.color = Color.white;
    10.         m_uiVertices [0] = vertex;
    11.  
    12.         // Top Left
    13.         vertex.position = new Vector3 (0, 5, 0);
    14.         vertex.uv0 = new Vector2 (0, 1);
    15.         //vertex.color = Color.yellow;
    16.         m_uiVertices [1] = vertex;
    17.  
    18.         // Top Right
    19.         vertex.position = new Vector3 (5, 5, 0);
    20.         vertex.uv0 = new Vector2 (1, 1);
    21.         //vertex.color = Color.red;
    22.         m_uiVertices [2] = vertex;
    23.  
    24.         // Bottom Right
    25.         vertex.position = new Vector3 (5, 0, 0);
    26.         vertex.uv0 = new Vector2 (1, 0);
    27.         //vertex.color = Color.blue;
    28.         m_uiVertices [3] = vertex;
     
  2. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Anyone else experiencing this behavior?
     
  3. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    And the rest of your code? Mesh setup?
     
  4. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    598
    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.
     
  5. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The rest is m_CanvasRenerer.SetVertices(m_uiVertices, 4);

    Which I didn't provide given the triviality of it all.
     
  6. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    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.
     
    Last edited: Jul 28, 2015
  7. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Can you give me a project that demonstrates the issue? Our internal test for this is passing, but maybe a corner case.
     
  8. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Here is a simple Repro Case 716597 showing this behavior.
     
    Last edited: Aug 1, 2015
  9. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    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!
     
  10. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    I'm on it right now.
     
  11. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Fixed :) getting in asap
     
  12. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Thanks Tim!

    Looking forward to the next beta release :)
     
  13. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    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)
     
    Last edited: Aug 8, 2015
  14. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Tim just indicated that Case 718455 has been addressed and the fix will be in the next release.
     
  15. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,079
    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?
     
  16. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,079
    Anyone? Are my questions not important enough to answer? :D
     
  17. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    As far is a know the changes only affect the Canvas Renderer.
     
  18. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,079
    Great. Thanks.
     
  19. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    SetVertices is on Mesh so it does affect meshes
     
  20. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,079
    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.