Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

GPU Instancing with UI elements

Discussion in 'General Graphics' started by hellowill89, Mar 8, 2018.

  1. hellowill89

    hellowill89

    Joined:
    Jan 8, 2013
    Posts:
    45
    I have a UI Menu with many uniform elements in it. When I frame debug, I notice that each new element is adding a draw call. Each element is using the Default UI Material. It seems I should be able to reduce draw calls by instancing the material, but when I make this call, it has no effect:

    Canvas.GetDefaultCanvasMaterial().enableInstancing = true;

    Has anyone had success in GPU instancing UI elements?
     
  2. hellowill89

    hellowill89

    Joined:
    Jan 8, 2013
    Posts:
    45
    I found that having elements with different z values on the canvas prevented batching. Aligning them on the z axis allowed them to be batched! Huge performance boost!
     
  3. Renardjojo

    Renardjojo

    Joined:
    May 15, 2019
    Posts:
    11
    This option also only work for UI elements in the same canvas only