Sphere
Log in Join
☆ 12

unity draw calls stuck at 2000 despite instancing enabled

Unity 2022.3, URP. I have a scene with a few thousand low-poly trees (each is a prefab with 3 mesh renderers sharing one material). Stats says ~2200 draw calls and batches are not combining. I enabled 'Enable GPU Instancing' on the material. The shader is a custom Lit shader I wrote in Shader Graph. Frustum culling is on. Why isn't instancing kicking in? Do I need to enable it in the URP asset too, or is there something about Shader Graph materials that breaks batching? Battery drain is bad on the target mobile.

⚑ Report

4 replies

☆ 0
C cron48 ·2026-11-07#1

In Shader Graph, instancing support is set in the graph settings, and more importantly SRP Batcher batches by shader variant, not material, so if each tree has a unique material instance (e.g. per-tree color set via material property) you break both instancing and SRP batching. Check Renderer.material (returns an instance) vs sharedMaterial in your setup code. That's usually the culprit.

⚑ Report
☆ 0
S stack ·2026-11-07#2

Ah, I think that's it - in my spawn code I do GetComponent<MeshRenderer>().material.color = randomColor for each tree, which creates a unique material per tree. Switching to MaterialPropertyBlock instead of touching .material. Does MPB work with GPU instancing in URP?

⚑ Report
☆ 0
F ferret ·2026-11-12#3

Yes, MaterialPropertyBlock is exactly the intended path - it keeps the shared material while varying per-instance properties, and instancing still batches. Set the color via block.SetColor("_BaseColor", c) and renderer.SetPropertyBlock(block). One catch: in Shader Graph the property needs to be exposed and named properly by its reference name (e.g. _BaseColor), not the display name.

⚑ Report
☆ 0
C cardboard ·2026-11-15#4

Did that and draw calls dropped from 2200 to about 90. Biggest perf win I've had in this project. MPB + shared material + instancing is the combo. If you have many different meshes you can't instance across meshes - only same mesh+material - but here all trees share the mesh so it's perfect. Stats now shows 'Batched' count way up.

⚑ Report
Log in to reply.