Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: johnnydj on February 09, 2014, 08:11:35 AM

Title: HUDText How to clear the label text?
Post by: johnnydj on February 09, 2014, 08:11:35 AM
hey I'm working on a game and I'm using HUDText right now to make a countdown timer when a ball hits a trigger.
For example, the ball hits a trigger and the countdown starts from 8.
But if the ball hits the trigger again, the countdown should start from 8 again.
It starts a new label with the number 8 counting down, but the problem is that the previous label is also under this new label and it seems like 2 numbers on top of each other.

I tried to disable and re-enable the HUDText but the countdown continues anyway...
Is there a way to force reset the label?
Or is there a way I can modify HUDText?

Thanks for the help.
Title: Re: HUDText How to clear the label text?
Post by: Nicki on February 09, 2014, 09:34:41 AM
Sounds like there's something screwy with the logic of HUDText.

I would recommend keeping some form of ID on the timers and have them in a dictionary somewhere - then we it updates, you can check for the key again, and if it's already there, just set the value higher, instead of spawning a new label.
Title: Re: HUDText How to clear the label text?
Post by: johnnydj on February 09, 2014, 09:52:42 AM
well I just fixed it in a totally different way :)
I just used the UI follow script on a cube, and referenced a UILabel to it.
That way I just manipulate the UILabel normally.