Author Topic: HUD UIFollowTarget displays then updates  (Read 2872 times)

YellowPoney

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
HUD UIFollowTarget displays then updates
« on: September 29, 2014, 05:28:57 PM »
Hi,
I have a scene with one UIFollowTarget object which has a healthbar child (a couple sprites). I use that UIFollowTarget to follow one of two objects. The way i switch the target goes like this :
-disable the healthbar
-change the target
-enable the healthbar
When i do that the healthbar shows up at the old target, then moves to the new target, even though i disable, change target and THEN enable.

What am i doing wrong ?
« Last Edit: September 29, 2014, 06:28:13 PM by YellowPoney »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: HUD UIFollowTarget displays then updates
« Reply #1 on: September 30, 2014, 04:35:15 AM »
UIFollowTarget's code doesn't kick in until Update(). If you move something manually like that, you also need to call its Update() function so that it's immediate. Make it public, then call it.

YellowPoney

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: HUD UIFollowTarget displays then updates
« Reply #2 on: September 30, 2014, 07:48:32 PM »
Done that. Works great.
Thank you  :D