Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Optimize draw call UI

Discussion in 'General Discussion' started by ducloc96, Apr 3, 2022.

  1. ducloc96

    ducloc96

    Joined:
    Mar 18, 2018
    Posts:
    26
    I have 2 mesh with same texture but get called twice draw call.
    Can anyone explain it to me? I am using sprite atlas for my UI.
    Size of atlas is 1024x2048
     

    Attached Files:

    • 1.PNG
      1.PNG
      File size:
      81.2 KB
      Views:
      215
    • 2.PNG
      2.PNG
      File size:
      81.7 KB
      Views:
      213
  2. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,753
    Are any of these things actually causing you performance issues? How many draw calls are you actually hitting?
     
  3. ducloc96

    ducloc96

    Joined:
    Mar 18, 2018
    Posts:
    26
    Ah, I'm wondering why it needs 2 draws for the same texture
     
  4. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,753
    Are they sorted the same and on the same Z level?
     
  5. ducloc96

    ducloc96

    Joined:
    Mar 18, 2018
    Posts:
    26
    Yes. It belongs to the same panel
     
  6. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,753
    Them being on the same panel doesn't imply either of those things. Again, I have to ask:

     
  7. Starpaq2

    Starpaq2

    Joined:
    Mar 14, 2013
    Posts:
    77
    Is your mesh within a scroll rect? or some sort of masked layer?

    If your ui component is nested within an object with a mask component, then the draw calls usually will double.
    I have not pursued a performance improvement for this.