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

Bug URP + 2D Renderer custom sprite Shader Graph not batching after creating materials instances

Discussion in 'Universal Render Pipeline' started by Chris-Trueman, Nov 14, 2022.

  1. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,260
    I've created a highlight shader for my sprites using Shader Graph. I created a Material for this shader and applied it to all my sprites.

    I got 7 SetPass calls which, only 1 is for my sprites. I then added code to create material instances so I can start turning the highlighting on. URP is supposed to batch by shader and not material, my setpass calls should not change all that much. The problem is none of my sprites batch after that.

    My Shader Graph is SRP batcher compatible according to the inspector.
    SRP batcher is on in the pipeline asset.
    Everything is on the same Sprite Atlas.

    Using:
    Unity 2021.3.12f
    URP 12.1.7
    Shader Graph 12.1.7
     
  2. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,503
    Try upgrading to 2023.1 alpha. From the patch notes:
     
  3. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,260
    Well I guess I can only use URP for lighting right now. I'm stuck on LTS.