Author Topic: UISlider and FGWidget set to enabled  (Read 5386 times)

zentuit

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 12
    • View Profile
UISlider and FGWidget set to enabled
« on: July 03, 2012, 02:10:28 PM »
I'm having an issue with using UISliders as health bars. Each unit gets a UISlider attached when spawned.  However if the spawn point is out of the visible camera, then the foreground widget pops up in the middle of the screen. 

My code is an extension of http://www.tasharen.com/?topic=creating-a-ui-sprite-on-the-fly.

The cause is that the UISlider Start calls Set which in turn enables the FGWidget. 

Anyone know how to hook in and reset the enabled flag after the UISlider Start call?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISlider and FGWidget set to enabled
« Reply #1 on: July 03, 2012, 02:37:35 PM »
Just disable the UISlider script if it's off-screen.

zentuit

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 12
    • View Profile
Re: UISlider and FGWidget set to enabled
« Reply #2 on: July 03, 2012, 02:57:08 PM »
Doh, UISlider isn't a UIWidget.

I'm fixed now, thanks.