Author Topic: UIButtonTween OnHoverFalse not working?  (Read 4279 times)

Gillissie

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 48
    • View Profile
UIButtonTween OnHoverFalse not working?
« on: May 25, 2012, 01:55:27 AM »
I'm trying to get another object to scale up to 1,1,1 when a button is moused over, and scale back down to 0,0,0 when moused out, but the mouse out doesn't do anything. Please see the attached screenshots of the button and the object that is the tween target. What am I doing wrong?

Gillissie

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 48
    • View Profile
Re: UIButtonTween OnHoverFalse not working?
« Reply #1 on: May 25, 2012, 02:31:17 AM »
After more experimentation, I found that if I have only one UIButtonTween component and use the OnHover event with Forward direction specified, it actually plays in reverse automatically when mousing out. Not very obvious to me though, and the docs don't mention it. I still would have expected the way I set it up originally to work anyway.

Gillissie

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 48
    • View Profile
Re: UIButtonTween OnHoverFalse not working?
« Reply #2 on: May 25, 2012, 02:40:06 AM »
Now I have another problem. The mouseover/mouseout tweening is working as I described in my last response, but for some reason the game is starting with the buttons as if they are all mouseover by default, so the target tween is triggering immediately even though the mouse isn't over the button.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIButtonTween OnHoverFalse not working?
« Reply #3 on: May 25, 2012, 10:17:32 AM »
You should disable the tween component or it will start playing right away.

Also note that there is an issue in Unity with objects starting with a scale of 0. You might want to use a really small value instead, and have the tween disable the object after the tween finishes.

Gillissie

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 48
    • View Profile
Re: UIButtonTween OnHoverFalse not working?
« Reply #4 on: May 25, 2012, 02:45:57 PM »
Thanks, disabling the component did the trick.