- Home /
 
How to show text using NGUI's UILabel?
void Start () {
     UILabel subtitle = GameObject.Find("GameObject").GetComponent<UILabel>();
     subtitle.text = "AAAAAAAAAAAAAAAAAAAAAAAAAA";
     Debug.Log(subtitle.text);
 
               }
This code can not show any text on the screen.What is wrong? Please
Answer by nicloay · Aug 30, 2012 at 08:51 AM
What is the name of your GameObject. You need to provide The object name On my screenshot it is a "Label" and i use "UILabel subtitle = GameObject.Find("Label").GetComponent();" 
$$anonymous$$y GameObject Name is "GameObject". I m a new into unity. Do you know any example of UILable? Thank you for your reply.
just press the enter in "hierarcy" browser and give unique name for you object, after that use this name in your code. And i hope you attached this code to any object in the scene (like to camera)
Your answer
 
             Follow this Question
Related Questions
Subtitles in fps game 2 Answers
Subtitles as a GUI (C#) 0 Answers
Press "E" to activate Object. Display Gui-texture or Text ?? 2 Answers
Unity UI Issue - Fit Panel to child Text, with a Max Size 0 Answers