Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: storm33229 on September 29, 2013, 07:27:49 PM

Title: How do I re-parent in NGUI?
Post by: storm33229 on September 29, 2013, 07:27:49 PM
Now that I know NGUITools.AddChild adds a gameobject properly, I am curious how to migrate to a different parent.
Title: Re: How do I re-parent in NGUI?
Post by: LightSky on September 29, 2013, 10:53:13 PM
gameObject.transform.parent  = new parent object.transform

Is this what you were looking for?  This changed the current object's parent to a new one.
Title: Re: How do I re-parent in NGUI?
Post by: storm33229 on September 29, 2013, 11:24:20 PM
gameObject.transform.parent  = new parent object.transform

Is this what you were looking for?  This changed the current object's parent to a new one.

Well, I use this one all the time... but I was curious if NGUI had a specific function for wrapping any special behavior it may want to do in addition to the re-parent.
Title: Re: How do I re-parent in NGUI?
Post by: ArenMook on September 30, 2013, 11:14:08 AM
After reparenting like that, make sure to broadcast "ParentHasChanged" to the affected game object.