Closed romanokeser closed 2 years ago
Ahoy! You are creating a local reference to sequence that exists only inside the method, so when you call that method FALSE that sequence ref is not the same. You should have your sequence variable stored outside the method, and only assign it inside it
See example (be sure you're not calling it TRUE twice in a row tho, or add some checks for it)
Sequence sequence;
private void FullscreenIconFadeAnimation(bool isAnimation)
{
if (isAnimation)
{
sequence = DOTween.Sequence();//sequence for fullscreen btn icon
sequence.Append(_fullscreenIconCG.DOFade(0f, 1f))
.Append(_fullscreenIconCG.DOFade(1f, 1f))
.SetLoops(-1, LoopType.Restart);
}
else
{
_fullscreenIconCG.DOFade(0f, 0.5f);
sequence.Kill();
}
}
I can't figure out what I'm doing wrong. I made a method that I call to either start or end the DOFade animation but the sequence doesn't stop.
Neither sequence.Kill() or sequence.SetAutoKill() works. The sequence.Kill is called but right after that the sequence.Start is called again even tho I call FullscreenIconFadeAnimation(true) once on button click.