Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: alexh0101 on December 19, 2014, 12:16:15 AM
-
I'm trying to reduce the number of draw calls.
I'm a bit a confused of how UI2DSprite size parameter interfere with the scale of the underlying gameObject.
How can the scale be 1 even when I change the "size" in UI2DSprite's parameter?
Does it increase draw calls when the UI2DSprite "size" is not identical to the size of the original sprite?
Also, does it increase draw call with I use fonts at a size other than its "default size"?
In the Draw Call Tool, many of my draw calls involves the following materials:
-[NGUI] myAtlas
-[NGUI] Unlit/Transparent Colored
-[NGUI] Sprites/Default
Do you think I should change all of these to Sprites/Default? (I'm making a mobile game and Sprites/Default is what I'm using for all the sprites in my game)
Thanks in advance
-
Changing size, either sprite's or font size has no effect on draw calls.
Having different materials does increase draw calls, especially if you have them on different layers and sandwich things, like this:
Sprite on depth 0 (atlas A)
Sprite on depth 1 (atlas B)
Sprite on depth 2 (atlas A)
The above, while only using 2 materials, will require 3 draw calls for the GPU to draw them in order like that.
If you keep your Sprites/Default on higher depth values than everything else and on the same panel, they will only be using 1 draw call (assuming you've asked Unity to place them into the same atlas).
-
I had a bunch of duplicated UIPanels with ScrollViews. They were sluggish on iOS. I noticed that their size was something like 1.00008, something that Unity does when duplicating stuff. I set it back to 1, and the movements became smooth. So there is certain connection.
-
Hi there,
Thanks for your response.
I chose to change all Unity2DSprite's material to Sprite/Default and the draw calls were reduced from 9 to only 5. Everything looks fine. But I'm curious to know what the point of the "Unlit/Transparent" shader is if all it takes is to change them to Sprite/Default in order to reduce draw calls.
What I just did is: (given that all my sprites come from a single Sprite packer and the font comes from a separate atlas)
Depth 0: my GUI window (1 sprite)
Depth 1: my buttons sprites (6 sprites)
Depth 2: my UILabels (6 labels)
I get 3 draw calls from that.
It seems it's at least 1 draw call per depth, is that correct?
So I presume I can't reduce it to 2 draw calls, even though my window sprite comes from the same Sprite Packer?
Thanks a lot
-
You can't reduce it to 2 draw calls if those 3 have to be drawn in the order you mentioned, and the middle one uses a different material.