Author Topic: Grouping UI Elements  (Read 3196 times)

poolts

  • Newbie
  • *
  • Thank You
  • -Given: 6
  • -Receive: 0
  • Posts: 33
    • View Profile
Grouping UI Elements
« on: May 13, 2014, 11:07:42 AM »
I've heard a few schools of thought on this:
  • Use an empty game object
  • Use an invisible widgit
  • Use a panel (which I believe is bad, as geometry will get needlessly redrawn, and should only be used if something(s) changes frequently)

I'm currently doing option 1 and just wanted to make sure that's the correct way to go.

P.S. I know this is a pretty simple question, but I searched the forums and found a few different answers, so wasn't really sure which is best.
« Last Edit: May 14, 2014, 04:57:05 AM by poolts »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Grouping UI Elements
« Reply #1 on: May 14, 2014, 05:26:22 AM »
Depends on what you're doing.

Generally you will want to have a panel container for each new window you create as moving panels is very efficient, while moving widgets is not. For regular grouping, an empty game object is perfectly fine. However if you want to be able to move the object in the scene view like a widget, then you will need to place a UIWidgetContainer on it. Using a widget is great if you are making good use of the layout system (anchoring), or if you want to control the alpha of a group of widgets (as widget alpha is cumulative).