Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: yanebra on June 01, 2013, 05:25:41 AM
-
Hi,
I have a problems here,
I have three UIsprite in the Panel under the UIroot.
Once the sprite has been clicked, I scripted it to instantiate another sprite to replace it,
however, the new generated sprite will be created out of the UIroot in the hierachy.
How can I solve it, to make the new sprite appear under the UIroot?
I have checked in this forum, but I really cannot understand, (a newbie in coding)
Please give a help hand.
Many Thx
Yan
-
Either set the parent of the new sprite directly (newSprite.transform.parent = theParent) or use the AddChild function in NGUITools (I believe)
-
Re: dlewis
Thank you very much, by your guide I have tackled it.
for others who may have same question FYR.
var Parent: String;
var theChild: GameObject;
NGUITools.AddChild(GameObject.Find("Parent"), theChild));