Author Topic: NGUITools.AddChild from prefab doesn't use same scale vlaues  (Read 4127 times)

bagomints

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
When I add a child with NGUITools.AddChild from a prefab, it's correctly adding but it's not using the same scale numbers as the prefab.

My Sprite prefab has 182, 178 for scale, but when I use AddChild, it didn't show up on the screen even though it worked, so I looked at the clone made from the prefab, and the clone's scale was 1,1.

Is this normal behavior? If not, am I saving the prefab incorrectly?

Right now I have to code the change in scale to the added child's with transform.localScale += a Vector3 with the hardcoded numbers and it works fine but I'm wondering why it won't take the prefab's scale values.
« Last Edit: June 21, 2013, 05:01:28 PM by bagomints »

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: NGUITools.AddChild from prefab doesn't use same scale vlaues
« Reply #1 on: June 21, 2013, 06:01:42 PM »
This is normal behavior.

Instantiating a prefab always sets its scale to 1,1,1.

Have a common object at the "root" of the prefab with position 0,0,0, rotation 0,0,0, scale 1,1,1 and an object lower in the hierarchy that sets everything up, then it works fine.

bagomints

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: NGUITools.AddChild from prefab doesn't use same scale vlaues
« Reply #2 on: June 21, 2013, 06:28:56 PM »
Ahh I see.

Can you tell I'm new to Unity too :p?

Thank you for explaining though, I fixed it.