1
\$\begingroup\$

With Unity 5 and access to the profiler, I'm running our game through some stress tests so I can find where our performance issues are.

While testing having 1024 units on the screen with 4 selection box corners each I ran into an odd problem. When I select all the units, 4096 selection box objects come into existence, my draw calls go from ~25 to 50 with 50 batches. Now when I tell the units to move, they rotate and the number of batches climbs up to 2090 and the draw calls climb to 2090 and stay there even after the units stop rotating or moving.

If I then reselect all the units, the selection boxes are destroyed and re-instantiated (I know, not the best way) and the batches and draw calls go back down to 50 from 2090.

What is causing this, and how would I go about fixing it?

After Selecting All Units After Selecting All Units

After having them rotate and move After having them rotate and move

After Re-selecting Them All After Re-selecting Them All

\$\endgroup\$
1
  • \$\begingroup\$ Do you have any code that's tweaking material properties? The copy-and-return behavior of a renderer's material or sharedMaterial properties can be important for this sort of thing. \$\endgroup\$
    – rutter
    Mar 5, 2015 at 2:13

0

You must log in to answer this question.

Browse other questions tagged .