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

Sprite Packer can't reduce draw call with resource load

Discussion in 'Scripting' started by ducloc96, Jul 8, 2021.

  1. ducloc96

    ducloc96

    Joined:
    Mar 18, 2018
    Posts:
    26
    I have sprites in Sprite folder and I have created prefabs using those sprites in resource folder.
    I packed the sprites together. When I load those prefabs it doesn't reduce the draw call.
    Can anyone help me?
     

    Attached Files:

    • 1.PNG
      1.PNG
      File size:
      40.2 KB
      Views:
      248
    • 2.PNG
      2.PNG
      File size:
      9.3 KB
      Views:
      248
    • 3.PNG
      3.PNG
      File size:
      96 KB
      Views:
      256
    • 4.PNG
      4.PNG
      File size:
      96.1 KB
      Views:
      250
    • 5.PNG
      5.PNG
      File size:
      162.4 KB
      Views:
      256
  2. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
    The UI still needs to create and draw those individual meshes, but you can see that the _MainTex is being shared between meshes, which should lead to less state switches on the GPU (the real FPS killer).
     
  3. ducloc96

    ducloc96

    Joined:
    Mar 18, 2018
    Posts:
    26
    I don't understand why the _MainTex is being shared between meshes. Is it because I load from resource folder?
    Thanks for your help
     
  4. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
    Sharing textures is a good thing. It means the GPU doesn't need to swap to a different texture state to draw the next mesh, which is as fast as drawing as you can have.
     
  5. ducloc96

    ducloc96

    Joined:
    Mar 18, 2018
    Posts:
    26
    When I made the objects available in the panel, the draw call dropped again. Is there a way to reduce the draw call for creating object from resource folder?
     

    Attached Files:

    • 6.PNG
      6.PNG
      File size:
      187.8 KB
      Views:
      236
    • 7.PNG
      7.PNG
      File size:
      81.1 KB
      Views:
      239