Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Somoraze on March 21, 2013, 12:19:47 AM

Title: [solved] update label text ?
Post by: Somoraze on March 21, 2013, 12:19:47 AM
Hi,

I am starting with NGUI, I would like to reach the label "score" to update the text, but the score is not updated, would you know how to achieve this?

  1. UILabel c = GameObject.Find("UIRoot").GetComponent<UILabel>();
  2. c.text = "The String You Want To Assign";

Thanks a lot
Title: Re: update label text ?
Post by: broken on March 21, 2013, 01:15:53 AM
UILabel component refers to "score" GameObject, not UIRoot.
Try:
  1. UILabel label = GameObject.Find("score").GetComponent<UILabel>();
  2. Debug.Log(label.text);
Title: Re: update label text ?
Post by: Somoraze on March 21, 2013, 03:16:45 AM
Okay thank you very much!