Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: WUTAI on October 24, 2013, 09:08:13 PM
-
HI
I have created a UILabel using NGUITools.AddChild(GameObject.Find("Panel"), myObject);
How can I access that new label to modify the text?
Thanks.
-
Well first of all, never use GameObject.Find. It's SUPER slow, and is generally a very poor coding practice to reference something by its name. Nothing is stopping someone from creating another object named "Panel" later on, and then which one gets returned from your "Find" function is anyone's guess.
Second, you have a game object that gets returned from AddChild. Just use GetComponent<UILabel>() on it.
-
I didn't know AddChild returned a game object. /facepalm
Thanks ;D