Author Topic: When to use Panels or widgets - understanding base design ideas  (Read 2856 times)

mickyg

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Hi All

With the recent demise of DFGUI, I have thrown my hat into the NGUI ring and am finding the process pretty painless (and indeed, NGUI seems to have a lot more powerful features that I struggled with in DFGUI).

One thing I'm not sure about, is when it is appropriate to use a Panel, and when I should just be using a Widget.

In DFGUI, they only have panels, however they do not split draw calls so I guess in a sense they function more like an NGUI Widget - just an empty container that is used for UI organisation and grouping.

My UI is composed of a number of discrete parts - a nested dropdown menu at the top, thumbstick controls at the bottom corners, and an inventory style section at the middle bottom. I initially set it up to have each of these different elements nested under a separate Panel, but I'm not sure if that's the best solution.

Is there some sort of design guideline documentation that anyone has come across that tries to explain how to best create a UI that fits n with NGUI's design philosophies? It's quite a bit more complicated than DFGUI so I don't want to go down the wrong path right from the start due to a simple misunderstanding of how NGUI works.

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: When to use Panels or widgets - understanding base design ideas
« Reply #1 on: August 10, 2014, 06:24:07 PM »
A panel is basically just a Renderer. All it does is collects widgets underneath it, and creates draw calls for them. You can get away with having just 1 panel (the default one that's on the UIRoot), but generally it's good practice to have 1 panel per unique window so that it's easy to bring them to front and/or fade them out.

It's also good to note that all panels manage their own draw calls separately, and if you have some frequently changing widget (like some widget with alpha that changes every update), then it may be beneficial to separate if from your static elements, so that its own changes don't affect the rest of the widgets.