Search Unity

Question Custom UI graphic and OnPopulateMesh being called on color change

Discussion in 'UGUI & TextMesh Pro' started by andyz, Jan 19, 2024.

  1. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,269
    Experimenting with overriding Graphic.OnPopulateMesh in UGUI I found something odd. If the color of the Graphic is changed it calls this function every time instead of applying a color to the material say, which seems remarkably inefficient unless it is some batching issue based on colors not changing often.
    Does it expect the mesh to be rebuilt with newly colored vertices or it should see if some color value only needs setting?
     
  2. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,269
    bump?!