dotween
dotween copied to clipboard
WaitForCompletion stuck on recycled tween
Description: Creating new tweens while yielding WaitForCompletion can cause some WaitForCompletion to never end. Reproduced only when tween recycling is on (global or per-tween). Tweens associated with stuck WaitForCompletion are the same (by hash code) that were recycled and reused by other animation script instance.
Steps to reproduce:
- Create scene with some 3d objects (11 cubes in my case)
- Add same animation script below to these 3d objects
- Start Play Mode
Expected: All 3d object moving synchronously
Actual: Some 3d objects not moving, stuck on WaitForCompletion.
Reproduced: Unity 2023.2.10f1 with DOTween 1.2.745 and 1.2.765 Unity 2022.3.17f1 with DOTween 1.2.745
Settings: Recycable: true Safe Mode: false AutoPlay: false AutoKill: true
Sample code:
using System.Collections;
using DG.Tweening;
using UnityEngine;
public sealed class Animation : MonoBehaviour
{
private IEnumerator Start()
{
yield return transform.DOLocalMoveY(0, 0.5f)
.SetRecyclable(true)
.Play()
.WaitForCompletion();
transform.DOLocalMoveY(1, 1)
.SetLoops(-1, LoopType.Yoyo)
.SetRecyclable(true)
.Play();
}
}