Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: bagomints on June 21, 2013, 04:52:08 PM

Title: NGUITools.AddChild from prefab doesn't use same scale vlaues
Post by: bagomints on June 21, 2013, 04:52:08 PM
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.
Title: Re: NGUITools.AddChild from prefab doesn't use same scale vlaues
Post by: Nicki 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.
Title: Re: NGUITools.AddChild from prefab doesn't use same scale vlaues
Post by: bagomints 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.