Pause, Restart, Rewind not working
« on: June 30, 2015, 06:23:37 AM »
Code: [Select]
void Start()
{
startRot = this.transform.eulerAngles;

buttons = this.transform.GetComponentsInChildren<ButtonSwitch>();

StartCoroutine(StartTween());
}

private IEnumerator StartTween()
{

yield return new WaitForSeconds(startDelay);

tween = this.transform.DORotate(new Vector3(0, 0, incrementInterval * direction), rotateSpeed, RotateMode.Fast);
tween.SetEase(Ease.Linear);
tween.OnStepComplete(NodePaused);
tween.OnStart(NodeStart);
tween.SetRecyclable(false);

DOTween.Sequence()
.Append(tween)
.AppendInterval(incrementTime)
.SetLoops(-1, LoopType.Incremental);

tween.Pause();
}

The tween will not pause, rewind, or even restart.

What am I doing wrong?

Thanks!

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: Pause, Restart, Rewind not working
« Reply #1 on: June 30, 2015, 09:42:05 PM »
Hi,

When you add a tween to a Sequence you can't control it anymore, because it's the Sequence that controls it. But: you can control the Sequence. So just assign your Sequence to a tween variable and you're done:

Code: [Select]
sequence = DOTween.Sequence()
// ...
sequence.Pause();

By the way, remember that if you want to reuse your tween/sequence after it's complete, you have to chain a SetAutoKill(false) to it, to prevent the tween to be automatically destroyed after completion.

Cheers,
Daniele

Re: Pause, Restart, Rewind not working
« Reply #2 on: June 30, 2015, 10:50:05 PM »
Thanks! ;D