Factor is never 0. Look at the function I posted. If you played it in reverse before, amount per delta will be negative, so factor will be set to 1 by ResetToBeginning(), not 0. That function depends on what the "beginning" was. If you played it forward, 'beginning' is factor 0 after. If you played it in reverse, beginning is 1.
I also asked what version of NGUI do you have?
3.5.8
that's my point, if match all the condition, the factor is 0 instead 1
* the tween is never played before( in my case it's disabled on prefab )
* the user play the tween in reverse( again, the tween never played before )
* the user want to ResetToBeginning everytime the tween is played
the code will like this one:
// -- somescript.cs, a gui controller --
// *1
private void Show()
{
_tween.ResetToBeginning();
_tween.PlayReverse();
}
// or like this, *2
private void Show()
{
_tween.PlayReverse();
_tween.ResetToBeginning();
}
in *1, the factor is set to 0f, and the tween will be played, BUT stop right away and fire event
===>
in one frame
1.ResetToBeginning()-> make factor 0f ( because PlayReverse() is not called yet )
2.PlayReverse()-> make amountPerDelta < 0f
3.update() called by PlayReverse()-> mFactor += amountPerDelta * delta;
-> make mFactor < 0f;
-> tween stopped
in *2, the factor is set to 1f AFTER ResetToBeginning,
but the FIRST update in PlayReverse(), mFactor += amountPerDelta * delta;
mFactor will be negative, and stop the tween
====>
also in one frame
1.PlayReverse()-> amountPerDelta < 0f
2.update() called by PlayReverse()-> mFactor += amountPerDelta * delta;
-> mFactor < 0f;
-> stopped
3.ResetToBeginning()-> make factor 1f ( because PlayReverse() is called )
-> BUT THE TWEEN IS ALREADY STOPPED, set to 1f is too late now
that makes users have to play PlayReverse() 2 times if the tween is first time played
of couse i can check the "first time play" in my Show(),
but i think this should be controlled by NGUI, instead of user.
users don't have to check the "first time play" everywhere if they notice the might play a tween in reverse in the very fist time