I am trying to run a DoTween and it runs well but when I want to stop it, it does not stop at all, it keeps running till it finishes. I am using the DoTween Sequence to kill it but somehow it is not working. What is the issue?
public float prevValue = 0;
Sequence mySequence = DOTween.Sequence ();
private void Update () {
UpdateSlider ();
if (Input.GetKeyDown (KeyCode.T)) {
LerpToThis (90);
} else if (Input.GetKeyDown (KeyCode.Z)) {
KillSequence ();
}
}
public void LerpToValue (float newValue) {
float myValue = prevValue;
DOTween.To (() => myValue , x => prevValue = x, newValue, 3.0f);
}
public void KillSequence () {
mySequence.Kill ();
}