Pausing Dotween

hello
I’m using DoTween in my project and trying to implement a pause system, which DoTween seems to ignore.

using UnityEngine;
using DG.Tweening;
[RequireComponent(typeof(DOTweenAnimation))]
public class DoAffactByPause : MonoBehaviour
{

    DOTweenAnimation _anim;
    public Transform _transform;
    bool paused = false;

    // Start is called before the first frame update
    void Awake()
    {
        _transform=transform;
        _anim = GetComponent<DOTweenAnimation>();
    }
    void Update()
    {
        if (PauseManager.Pause && !paused)
        {
            Pause();
        }
        else if (!PauseManager.Pause && paused)
        {
            Unpause();
        }
    }

    void Pause()
    {
        DOTween.Pause(_transform);
        paused = true;
    }
    void Unpause(){
        DOTween.Play(_transform);
        paused = false;
    }
}

the script is implemented on the same transform in which the animation runs.
What did I miss?

Edit: I did manage to stop it when using the obvious Time.timescale=0.
However it would like a solution that doesn’t affect the whole scene necessarily.

3 years later, but in case you didn’t figure it out, you have to say transform.DOPause() and transform.DOPlay()

3 Likes