- Home /
How to reduce Draw-Calls?
Hello!
I thought that my new camera was lagging, but it is actually a deeper issue that I've caused myself with some recent changes.
Here is the profiler data. Can someone with more experience spot what could be causing the lag?
iPhone Unity internal profiler stats:
cpu-player> min: 17.0 max: 98.6 avg: 24.8
cpu-ogles-drv> min: 3.3 max: 4.0 avg: 3.6
cpu-present> min: 1.0 max: 4.0 avg: 1.5
frametime> min: 24.0 max: 117.2 avg: 38.5
draw-call #> min: 125 max: 125 avg: 125 | batched: 0
tris #> min: 42664 max: 42664 avg: 42664 | batched: 0
verts #> min: 28130 max: 28130 avg: 28130 | batched: 0
player-detail> physx: 0.6 animation: 0.0 culling 0.0 skinning: 0.0 batching: 0.0 render: 12.4 fixed-update-count: 1 .. 5
mono-scripts> update: 1.3 fixedUpdate: 0.6 coroutines: 0.0
mono-memory> used heap: 634880 allocated heap: 1097728 max number of collections: 0 collection total duration: 0.0
How do I reduce draw-calls?
Answer by hexagonius · Feb 20, 2015 at 04:03 PM
It's the drawcalls you have a problem with. Try getting them down by using as few materials as possible. Try merging textures into atlases.
Is there anything else that could be the reason? I don't recall adding any additional materials before the lagging started. :/
Comparing to the screenshot of the Unity iOS Profiler, besides your overall larger numbers at least I am not seeing anything else. In my experience 125 drawcalls is just way too much. $$anonymous$$aybe some code got more expensive on the CPU causing the stutter now, but bringing the drawcalls down is a task you should definitely address yourself to.
I'll get right on it. Thanks for your answer!
I'll comment here if it doesn't solve the lag.
By the way, the lag instantly stops when I cross the finishline.
I checked the "static" checkbox in the inspector for the cubes, asphalt and directional lights. Still over 100 draw calls. Do you know why there are so many? Canvas? Should I check the "static"-box on each Canvas object?