Author Topic: Hierarchical Scale Inheritance  (Read 6696 times)

artician

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Hierarchical Scale Inheritance
« on: September 20, 2012, 04:37:45 AM »
Can someone please explain how child objects in NGUI inherit their parents scale? 

I am following the Scrolling View writeup.  In it I'm instructed to add a child-Panel to the main Panel.  I've done this, but I'm unable to add anything directly to this child-Panel afterward.  What I've ended up doing is creating the objects as normal (attached to the original Parent Panel), and then dragging them into the child-Panel to parent them to it.

Whenever I place an object beneath another NGUI object like this, its scale is reset to 0.  If I try to manually correct that scale, it's unreliable and the graphic distorts. 

Am I doing something wrong?  If not, can someone please explain the logic behind the scale inheritance and how I should go about fixing my, labels, sprites and sliced sprites?

Thank you very much!

PhilipC

  • Guest
Re: Hierarchical Scale Inheritance
« Reply #1 on: September 20, 2012, 09:38:55 AM »
I wonder why your unable to parent it to a different object when creating it. In the NGUI widget creation window there is a field beside the "add to" button which shows what parent the new object will be associated with. To change this parent all you need to do is select you new panel in the hierarchy view.

Also i'm unsure why changing the parent manually would set the scale to zero that just seems odd to me.

artician

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Re: Hierarchical Scale Inheritance
« Reply #2 on: September 20, 2012, 06:16:18 PM »
I'm happy to hear that it's not supposed to work the way I'm seeing. 

For the direct parenting/creation of child objects, I tried both dragging the new Panel into the Add To slot, as well as clicking the circular browse button and selecting it via the Select GameObject popup, but both methods result in the new object being placed under the original parent (along side the Panel object that I want).

I would love to hear some more things I could try.  I have a project due tomorrow that's dependent on this working, and right now my solution is hackey.

Thanks very much.

PhilipC

  • Guest
Re: Hierarchical Scale Inheritance
« Reply #3 on: September 20, 2012, 06:22:49 PM »
Could you take a screen shot of your hierarchy? As i just tried it and it seems to work how expected. Maybe try to reproduce it in a new fresh scene?

Also why do you have a panel as a child to another panel? What are you trying to achieve?

artician

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Re: Hierarchical Scale Inheritance
« Reply #4 on: September 20, 2012, 06:51:25 PM »
Here you go:



I've highlighted the two Panels.

As for why I'm doing this.  This writeup instructed me to do so: http://www.tasharen.com/?page_id=4444

artician

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Re: Hierarchical Scale Inheritance
« Reply #5 on: September 20, 2012, 08:14:13 PM »
I started from scratch and it works fine now! 

I would love to know what the cause of it was though. 

Thanks again for your help.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Hierarchical Scale Inheritance
« Reply #6 on: September 21, 2012, 03:19:14 AM »
Maybe you have it in the wrong Unity layers and it cocks up. That happens from time to time if you use the regular "New gameobject" with unity and you use custom layers for your GUI.