Support => NGUI 3 Support => Topic started by: kittikun on May 16, 2014, 04:48:35 AM
Title: UITweener issue with repeated calls to PlayForward and PlayReverse
Post by: kittikun on May 16, 2014, 04:48:35 AM
Hi,
I have been using a lot of tweens to animate my UI with a lot of PlayForward and PlayReverse, depeding on the state of the game and I've been running into various problems
To easily test, please modify UITweener.cs to add a context menu to them
[ContextMenu("PlayForward")]
publicvoid PlayForward()
[ContextMenu("PlayReverse")]
publicvoid PlayReverse()[/td]
Then create a simple scene with a sprite and a tween position
- The tween will run when you start the scene x Play Reverse, the item "jumps" to From x Play Format, same as play reverse
Is the way I am using it wrong ?
I found the following workaround to be working:
publicstaticvoid Play(this TweenPosition tween, Vector3 from, Vector3 to, float duration)
{
tween.from=from;
tween.to= to;
tween.duration= duration;
tween.ResetToBeginning();
tween.ignoreTimeScale=false;
tween.PlayForward();
}
But I will still have problems after call PlayReverse() so I have to addcomponent tween and destroy them during onEnable and onDisable/
Also sometimes, OnFinished is not correctly called
Is something wrong with my usage ?
Title: Re: UITweener issue with repeated calls to PlayForward and PlayReverse
Post by: ArenMook on May 16, 2014, 01:30:31 PM
Nothing jumps when I play forward or reverse. All the PlayForward or PlayReverse functions do is call Play inside, and that function simply sets the "amount per delta" and re-enables the script, letting it play. It doesn't reset the current position. If you call PlayReverse halfway through playing it forward, it will simply reverse the direction.
What version of NGUI are you using?
Title: Re: UITweener issue with repeated calls to PlayForward and PlayReverse
Post by: kittikun on May 17, 2014, 11:33:32 AM
Strange, this I have been having this issue for a while now
I'm currently on 3.5.8
Title: Re: UITweener issue with repeated calls to PlayForward and PlayReverse
Post by: ArenMook on May 17, 2014, 06:46:51 PM
http://youtu.be/jDxWG81sNPc?t=12m09s
Title: Re: UITweener issue with repeated calls to PlayForward and PlayReverse
Post by: kittikun on June 02, 2014, 01:48:06 AM
Nevermind, I don't have time to debug this properly to propose a fix so I just decide to use iTween