Author Topic: [solved] update label text ?  (Read 2434 times)

Somoraze

  • Guest
[solved] update label text ?
« 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
« Last Edit: March 21, 2013, 03:17:13 AM by Somoraze »

broken

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 140
    • View Profile
Re: update label text ?
« Reply #1 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);

Somoraze

  • Guest
Re: update label text ?
« Reply #2 on: March 21, 2013, 03:16:45 AM »
Okay thank you very much!