Author Topic: HUDText How to clear the label text?  (Read 3539 times)

johnnydj

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
HUDText How to clear the label text?
« 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.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: HUDText How to clear the label text?
« Reply #1 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.

johnnydj

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
Re: HUDText How to clear the label text?
« Reply #2 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.