Author Topic: Widget containers and draw calls  (Read 3302 times)

db82

  • Guest
Widget containers and draw calls
« on: August 13, 2012, 05:50:54 AM »
Hi

I have a game object that has 2 UILabels in it.

At the moment the game object is a UIPanel, and I add loads of these to a parent UIPanel so the tree is like this


UIPanel
  - UIPanel
       - UILabel1
       - UILabel2
  - UIPanel
       - UILabel1
       - UILabel2
  - UIPanel
       - UILabel1
       - UILabel2
  - UIPanel
       - UILabel1
       - UILabel2

Doing it this way increases the draw calls because each UIPanel is using 2 draws, so the total for the above is 8 even though I'm only using 2 font atlases.

I cant really add all the labels straight into the master UIPanel because Label1 and Label2 need to be in one container for position and scale tweening.

Is there a better way I can do this to bring the draw calls down?

Thanks for any help!



« Last Edit: August 13, 2012, 06:44:29 AM by db82 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Widget containers and draw calls
« Reply #1 on: August 13, 2012, 08:59:15 AM »
Not quite sure why your desire to tween or position something would result in new panels? You can tween any game object, it doesn't have to have a panel.

db82

  • Guest
Re: Widget containers and draw calls
« Reply #2 on: August 13, 2012, 09:05:33 AM »
I'm using 2 labels to make a popup sprite to show a combo score. (see attached)

This popup is added to the stage and animates in / out. It's easier to animate it as one object rather than 2 separate UILables.

There are lots of these popups on screen at any one time.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Widget containers and draw calls
« Reply #3 on: August 13, 2012, 09:07:36 AM »
Right, but you can animate any game object. It doesn't need to have a panel on it.

GameObject (Animation)
- Label
- Label

db82

  • Guest
Re: Widget containers and draw calls
« Reply #4 on: August 13, 2012, 09:16:23 AM »
You are right, removing the UIPanel script for the popup did it  ;D

Can't remember why I added it in the first place, im sure there was a reason but never mind!

Thanks for your help.