Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: paw9000 on June 18, 2014, 08:32:02 PM

Title: Sprites scale/position in Panel different between game and scene view
Post by: paw9000 on June 18, 2014, 08:32:02 PM
I have an issue where a sprite in my scene view is not the same size or position in my game view when its inside of a separate panel.  Any common gotchas that might explain that?  Sprite might be 1/8th the scale of what it looks like going from scene to game view.

My layout is something like this:
UIRoot (Has a Panel)
|
-> |-Bunch of other NGUI controls
   |-Empty game object (transform set to identity)
   | |
   | ->Panel (game object transform set to identity)
   |   |
   |   ->Sprite
   |-Bunch of other NGUI controls

If I drag the sprite up a level it shows up fine.  Clipping is set to None.  Panel object has a rigidbody.  Trying to make a separate dialog.
Title: Re: Sprites scale/position in Panel different between game and scene view
Post by: paw9000 on June 19, 2014, 02:08:08 PM
Solved the problem!  My bad.  The issue was the child panel was set to a different layer then the rest of the GUI.

Once I changed it to the same layer that all the other NGUI elements were on then things lined up and worked as expected.  Slightly surprised that when I add a panel from the NGUI menu that the resulting panel didn't inherit the layer of its parent, but not a big deal.

Thanks for the very helpful console message which I missed yesterday saying:
"You can't place widgets on a layer different than the UIPanel that manages them."

My apologies and thanks for a wonderful product! =)