2
\$\begingroup\$

We are developing a game in Unity 4.6.6 for both Android and iOS.

Currently I am building the game UI with the new Unity UI system. In particular I am building a button list to create kind of inventory slots using the Grid Layout.

I have noticed that my draw call count is increasing considerably despite having my UI in an atlas (using Sprite packer) and using the same font all over the UI. After some tests I noticed that one draw call is generated per each UI Text and UI image present in the scene composing each button when using a Grid Layout Group, when the Grid Layout is not used the draw calls are reduced noticeably.

7 elements without Grid Layout, results in 2 draw calls: (Screenshots taken in play mode) enter image description here

7 elements WITH Grid Layout, resulting in 14 draw calls: (Screenshots taken in play mode) enter image description here

I have no idea if it is possible to reduce the number of draw calls when using the Grid Layouts.

\$\endgroup\$
  • \$\begingroup\$ Try newest version, they did different optimizations in uGUI system \$\endgroup\$ – Maxim Kamalov Sep 8 '15 at 16:14
  • \$\begingroup\$ Thanks @MaximKamalov, latest version of the 4.x series or in the 5.x series? \$\endgroup\$ – VicM Sep 15 '15 at 16:45
  • \$\begingroup\$ I'm afraid only 5.2+ has these optimizations. Read about it more here: blogs.unity3d.com/ru/2015/09/07/making-the-ui-backend-faster (especially sentences, where draw calls are mentioned). Essentially, they had to forget about performance to provide us this functionality more quickly, until now (when 5.2 is made). I understand that you have reasons to stay at 4.6.6, but I wouldn't be surprised if it turns out that upgrading to 5.2 is the only option. \$\endgroup\$ – Maxim Kamalov Sep 15 '15 at 17:33
-1
\$\begingroup\$

Without code to reference the only thing I can assume is that the grid is adding another object to each button. Each button is one call, so 7, and the only reasonable assumption is that the layout is adding an additional call to each, now totaling 14.

From what it looks like, you're forcing height and width bounds and spacing is either assigned or being split between them all. 2 passes on each button versus whatever you where using in the first screenshot.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.