Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Dengao on December 03, 2015, 11:05:14 AM

Title: scaling problem
Post by: Dengao on December 03, 2015, 11:05:14 AM
Hey. When i moving a child-sprite out of his parent, or duplicating an sprite, its scaling goes to 0,0,0. Any Fix for it? its also a problem when i use drag and drop function to move it to a "drag and drop container". The scaling goes to 0,0,0 when it get parentet to the container object.

thanks in advance.
Title: Re: scaling problem
Post by: seilz on December 03, 2015, 11:41:32 AM
How do you change parents?
Usually you would do something like:

  1. gameObject.transform.SetParent(parentObject.transform, false);

The second param does the trick. It prevents your child from getting modified in scalings.
Read more at: http://docs.unity3d.com/ScriptReference/Transform.SetParent.html (http://docs.unity3d.com/ScriptReference/Transform.SetParent.html)