mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2026-02-11 17:48:47 +08:00
Fixed error generated by calling KillAll from inside an OnComplete callback
This commit is contained in:
parent
2a8e7cc55c
commit
8718c07287
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -30,6 +30,7 @@ public class IndexOutOfRangeReproduced : BrainBase
|
||||
totCreatedTweens++;
|
||||
Tween t = target.DOMove(new Vector3(1, 1), 0.5f);
|
||||
if (i == 49) t.OnComplete(()=> DOTween.KillAll());
|
||||
t.Goto(100);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -40,6 +40,9 @@ namespace DG.Tweening.Core
|
||||
static int _minPooledTweenerId = -1; // Lowest PooledTweeners id that is actually full
|
||||
static int _maxPooledTweenerId = -1; // Highest PooledTweeners id that is actually full
|
||||
|
||||
// Used to prevent tweens from being re-killed at the end of an update loop if KillAll was called during said loop
|
||||
static bool _despawnAllCalledFromUpdateLoopCallback;
|
||||
|
||||
#if DEBUG
|
||||
static public int updateLoopCount;
|
||||
#endif
|
||||
@ -180,6 +183,8 @@ namespace DG.Tweening.Core
|
||||
_maxActiveLookupId = _reorganizeFromId = -1;
|
||||
_requiresActiveReorganization = false;
|
||||
|
||||
if (isUpdateLoop) _despawnAllCalledFromUpdateLoopCallback = true;
|
||||
|
||||
return totDespawned;
|
||||
}
|
||||
|
||||
@ -401,9 +406,14 @@ namespace DG.Tweening.Core
|
||||
}
|
||||
// Kill all eventually marked tweens
|
||||
if (willKill) {
|
||||
DespawnTweens(_KillList, false);
|
||||
int count = _KillList.Count - 1;
|
||||
for (int i = count; i > -1; --i) RemoveActiveTween(_KillList[i]);
|
||||
if (_despawnAllCalledFromUpdateLoopCallback) {
|
||||
// Do not despawn tweens again, since Kill/DespawnAll was already called
|
||||
_despawnAllCalledFromUpdateLoopCallback = false;
|
||||
} else {
|
||||
DespawnTweens(_KillList, false);
|
||||
int count = _KillList.Count - 1;
|
||||
for (int i = count; i > -1; --i) RemoveActiveTween(_KillList[i]);
|
||||
}
|
||||
_KillList.Clear();
|
||||
}
|
||||
isUpdateLoop = false;
|
||||
|
||||
@ -32,7 +32,7 @@ namespace DG.Tweening
|
||||
public class DOTween
|
||||
{
|
||||
/// <summary>DOTween's version</summary>
|
||||
public static readonly string Version = "1.1.250";
|
||||
public static readonly string Version = "1.1.260";
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// Options ////////////////////////////////////
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user