Author Topic: To use Panel or Empty Gameobject?  (Read 3478 times)

duncanx

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
To use Panel or Empty Gameobject?
« on: June 26, 2013, 03:13:10 AM »
When you use clipping on a panel, everything attached to that panel gets clipped...but you'll usually want to have a background of some sort...probably a tiledsprite. For example if we are making a floating window that has some scrollable elements in it. My question, for that background (or stuff that we don't want to get clipped) is it best to use another UIPanel or just attach the tiledsprite to an empty gameobject?

In the unity hierarchy we get something like...

Option A
  • UIPanel that is just holding a tiledsprite
  • UIPanel that is doing some fancy clipping on whatever other elements

Option B
  • Empty Gameobject that has a tiledsprite child
  • UIPanel that is doing some fancy clipping on whatever other elements

Which case should I use?

dlewis

  • Guest
Re: To use Panel or Empty Gameobject?
« Reply #1 on: June 26, 2013, 05:29:25 AM »
Everything needs to be under a UIPanel so make one for the background (sans clipping)

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: To use Panel or Empty Gameobject?
« Reply #2 on: June 26, 2013, 05:44:14 AM »
If there's no UIPanel anywhere above a widget in the hierarchy, NGUI adds one by itself. It is smarter that you control it yourself and add one.

duncanx

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: To use Panel or Empty Gameobject?
« Reply #3 on: June 26, 2013, 06:05:02 AM »
Ah - that makes sense. Thanks!