Thus UILabel out display not the Score but infinite line of figures. Example, if the Score is equal to zero, it deduces: 000000000000000000000000000000000000000000000000000 (infinitely). How to solve? There is a something like .ToString () for (UILabel).text?
Excuse for my english ;)
Title: Re: Score to string in NGUI.
Post by: dlewis on July 10, 2012, 02:03:32 AM
You should be keeping a local variable of the score and every time that is updated then update the label, don't use the use the label as data storage.
int score =0;
score += scorePoints;
label.text= score.ToString();
I use C# so I don't know if javascript has ToString so you could use...whatever the javascript equivalent is for printing a value to string and then assigning it.
Title: Re: Score to string in NGUI.
Post by: ArenMook on July 10, 2012, 02:04:43 AM
GameObject.Find in Update is a VERY slow operation.
Change it to a public reference instead:
public UILabel scoreLabel;
...then set it in inspector via drag & drop.
P.S. This is C# code. I don't use javascript, so I can't support it.
Title: Re: Score to string in NGUI.
Post by: faceOFF on July 10, 2012, 02:19:35 AM