Jump to content
  • Advertisement
Sign in to follow this  
achiga

Gameplay [Unity]Too many drawcalls for miniMap

Recommended Posts

Hi folks,

I am currently working on implementing a minimap for our FPS game. We have roughly one hundred players needed to be shown on mini map for observation mode. The icons are using the same sprite with different colors and texts(set with code). The texts can not overlap with each other. So I just assigned different depth values to different icons. But that caused more than 100 drawcalls. I am wondering if there is any way to improve it.

Share this post


Link to post
Share on other sites
Advertisement

I know that drawcalls of meshes with same material can be batched. However, in my case, I set texts on each sprite(UILabel), it seems that batching is broken by this action. But I need texts stay exactly on the top of the corresponding icon. Any ideas to reduce the drawcall? 

 

Update:

The same issue seems be here : http://www.tasharen.com/forum/index.php?topic=15517.0

Edited by achiga

Share this post


Link to post
Share on other sites

How are you displaying the sprites? Are you using Unitys UI system (UGUI), or are you using something else? (The linked thread uses NGUI.)

What do you means by "assign different depth"? Unity UI doesn't offer to set a depth, but only a z-value on the transform, and an order in layer value.

Share this post


Link to post
Share on other sites
17 hours ago, Sacaldur said:

How are you displaying the sprites? Are you using Unitys UI system (UGUI), or are you using something else? (The linked thread uses NGUI.)

What do you means by "assign different depth"? Unity UI doesn't offer to set a depth, but only a z-value on the transform, and an order in layer value.

I'm using NGUI to display the sprites. So the order of rendering all the sprites are based on depths instead of z-values. It seems drawcall batching is broken since sprites and labels have adjacent depths but they are using different textures.

Share this post


Link to post
Share on other sites

Does the batching work as expected...

  • ... if you assign the same depth value?
  • ... if you assign the same sprite (from the same texture/atlas)?

To be honest, I didn't work with NGUI enough. Is the project on the other hand old enough to "justify" the decision for NGUI and against Unitys UI system (UGUI, the new one)? I'm not absolutely certain about it, but it seems like you might end up having a better development using UGUI since it's used by far more people nowadays.

Share this post


Link to post
Share on other sites
1 hour ago, Sacaldur said:

Does the batching work as expected...

  • ... if you assign the same depth value?
  • ... if you assign the same sprite (from the same texture/atlas)?

To be honest, I didn't work with NGUI enough. Is the project on the other hand old enough to "justify" the decision for NGUI and against Unitys UI system (UGUI, the new one)? I'm not absolutely certain about it, but it seems like you might end up having a better development using UGUI since it's used by far more people nowadays.

Thank you for reply.

  1. Yes, as long as I assign the same depth value to the sprites and another value(either higher or lower) to the labels. The batching works as expected.
  2. I have not tried to use the same texture/atlas but I believe that works. However, this workaround would take more time since we need more art resources.

The project has been for more than 3 years. They had to use NGUI at that time and did not have a chance to migrate to UGUI. So we have to work on NGUI for now. And there are few tutorials and references about NGUI online nowadays, which blocks the development sometimes. 

Share this post


Link to post
Share on other sites
1 hour ago, achiga said:

I have not tried to use the same texture/atlas but I believe that works. However, this workaround would take more time since we need more art resources.

This was not a suggestion to solve the Issue, but to investigate it. If there is no batching even for the same texture/atlas, then either there is a bug in NGUI, or there is no way to batch across multiple depth values.

1 hour ago, achiga said:

The project has been for more than 3 years.

That's actually what I was afraid of: a project started a long time ago. Depending on how long you're supposed to support this game, you could on the one hand just do a simple and stupid solution (even if it's not the most elegant one), or on the other hand slowly replace the entire UI by UGUI (if the project is still developed on and is supposed to be continued for a long time).

Share this post


Link to post
Share on other sites
11 hours ago, Sacaldur said:

This was not a suggestion to solve the Issue, but to investigate it. If there is no batching even for the same texture/atlas, then either there is a bug in NGUI, or there is no way to batch across multiple depth values.

That's actually what I was afraid of: a project started a long time ago. Depending on how long you're supposed to support this game, you could on the one hand just do a simple and stupid solution (even if it's not the most elegant one), or on the other hand slowly replace the entire UI by UGUI (if the project is still developed on and is supposed to be continued for a long time).

Thank you for your suggestion. I will take a look at that. Perhaps we should start to think about moving to UGUI since our game is still in development.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!