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.