Search Unity

RenderMesh Bug

Discussion in 'Graphics for ECS' started by cloud1989, Aug 24, 2019.

  1. cloud1989

    cloud1989

    Joined:
    May 30, 2016
    Posts:
    32
    Code (CSharp):
    1.         var renderMesh = EntityManager.GetSharedComponentData<RenderMesh>(meshEntity);
    2.  
    3.         renderMesh.mesh.vertices = Vertices.ToArray();
    4.         renderMesh.mesh.triangles = Triangles.ToArray();
    5.         renderMesh.mesh.colors = Colors.ToArray();
    6.         renderMesh.mesh.RecalculateNormals();

    The color order is totally wrong,the last one should be the first.Why?
    Looking forward to your reply,thx!
     
  2. cloud1989

    cloud1989

    Joined:
    May 30, 2016
    Posts:
    32
    I found the bug,it's caused by the entity order in the job Execute,the last one always come first!
    This is kind of odd!
     
  3. cloud1989

    cloud1989

    Joined:
    May 30, 2016
    Posts:
    32
    So the right entity order should be 0->1->2->3,but in the Job Execute,the entity order is 3->1->2->0,I do not understand why!
     
  4. cloud1989

    cloud1989

    Joined:
    May 30, 2016
    Posts:
    32
    By the way,the right color remix should look like this!Bug fixed!
     
  5. cloud1989

    cloud1989

    Joined:
    May 30, 2016
    Posts:
    32