Author Topic: appropriate roots  (Read 5195 times)

judy3t

  • Guest
appropriate roots
« on: April 23, 2012, 10:28:23 PM »
I am getting the error "Unable to find an appropriate root to add the widget.
Please make sure that there is at least one game object above this widget!"

I have no idea why.  Everything looks right in the hierarchy.  It may be due to adding a collider to a sprite - would that be a problem?  I do that so I can use .depth and get the collider out of the way too.  Is there an easier way to do that?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: appropriate roots
« Reply #1 on: April 23, 2012, 10:33:42 PM »
Make sure your objects leading up to your widget use a scale of (1, 1, 1) and that you are adding this widget as a child of another object (NGUITools.AddWidget).

judy3t

  • Guest
Re: appropriate roots
« Reply #2 on: April 24, 2012, 09:05:37 PM »
The widgets don't fit scaled 1:1:1 - should I make an empty object under which to put them?   I believe when I started by scaling everything but the widget, I hit a problem with scales resetting themselves.  The only way I got the scales to "stick" was by re-scaling the parent widget. 

How do you manage to always scale the top widget at 1:1 when using artwork that will be large in some places and small in others?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: appropriate roots
« Reply #3 on: April 24, 2012, 11:49:54 PM »
If you scale widgets or their parents, then you lose pixel-perfection, resulting in blurry looking UI.

Always keep all widgets leading up to parents at (1, 1, 1), with the sole exception of UIRoot. If you need to scale something, scale the widget itself. Scales don't reset themselves unless you click "Make Pixel-Perfect".

If you absolutely must scale the parent of a widget, do so uniformly. Ie: Scale of (2, 2, 1) is not uniform, but (2, 2, 2) is.