Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: schneidb on May 20, 2014, 07:13:21 PM

Title: Tween Alpha repeat use problem
Post by: schneidb 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?
Title: Re: Tween Alpha repeat use problem
Post by: ArenMook 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.
Title: Re: Tween Alpha repeat use problem
Post by: schneidb 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!