Author Topic: Tween Alpha repeat use problem  (Read 2845 times)

schneidb

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 2
  • Posts: 24
    • View Profile
Tween Alpha repeat use problem
« on: May 20, 2014, 07:13:21 PM »
I've attached a Tween Alpha component to a UIWidget (which contains a UILabel) to fade the label out after a message has been posted the label.  I have (in the Inspector) set the From field to 1 and the To field to 0 and the Play Style to Once. 

When my message event triggers, I activate the UIWidget's GameObject and in the Tweener's OnFinished event, I'm calling another method to deactivate the UIWidget's GameObject.

This all works as expected the first time, but doesn't work in subsequent activations of the UIWidget's GameObject.  I've tried enabling/disabling the GameObject both via GameObject.SetActive and NGUITools.SetActive with the same result.  It appears that the Tween Alpha component is getting set to false when its OnFinished event fires (regardless of my method) and the alpha remains at 0 after the tweener has set it to that value.

Am I doing this wrong?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Tween Alpha repeat use problem
« Reply #1 on: May 20, 2014, 11:06:57 PM »
Once a tween plays to the end, that's it. You have to ResetToBeginning() on it for it to play again.

schneidb

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 2
  • Posts: 24
    • View Profile
Re: Tween Alpha repeat use problem
« Reply #2 on: May 20, 2014, 11:40:59 PM »
That's it!  I also figured out that I need to set enabled = true as well on the tweener component.  Now working exactly as I wanted.  Thanks!