Demigiant Forum
Unity Assets => DOTween & DOTween Pro => Topic started by: Thenamelessone on June 30, 2015, 06:23:37 AM
-
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!
-
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:
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
-
Thanks! ;D