In UIButtonTween, if I set resetOnPlay to true, it will fail every other time it runs, starting the 2nd time
This happens between of this code:
// Toggle or activate the tween component
if (playDirection == Direction.Toggle) tw.Toggle();
else tw.Play(forward);
if (resetOnPlay) tw.Reset();
tw.Play(forward) will call Play(), with mFactor already set to 1.0 due to the prior execution
public void Play (bool forward)
{
mAmountPerDelta = Mathf.Abs(amountPerDelta);
if (!forward) mAmountPerDelta = -mAmountPerDelta;
enabled = true;
Update();
}
With Style.Once, Update() will then run this code:
// Disable this script unless the function calls above changed something
if (mFactor == 1f && mAmountPerDelta > 0f || mFactor == 0f && mAmountPerDelta < 0f)
{
enabled = false;
}
Lastly, Reset() will reset mFactor, but too late.
public void Reset ()
{
mStarted = false;
mFactor = (mAmountPerDelta < 0f) ? 1f : 0f;
Sample(mFactor, false);
}
I believe the correct fix is in UIButtonTween.cs, it should call tw.Reset() first, then tw.Play() second.