1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-20 09:16:02 +08:00

[bugfix] Slightly modified and implemented Andrey Timofeev's fix for new IndexOutOfRangeException

This commit is contained in:
Demigiant 2016-10-26 13:17:08 +02:00
parent 85b2efd056
commit 1b2b216948
52 changed files with 39 additions and 13 deletions

View File

@ -356,6 +356,7 @@
<summary> <summary>
Checks all active tweens to find and remove eventually invalid ones (usually because their targets became NULL) Checks all active tweens to find and remove eventually invalid ones (usually because their targets became NULL)
and returns the total number of invalid tweens found and removed. and returns the total number of invalid tweens found and removed.
IMPORTANT: this will cause an error on UWP platform, so don't use it there
BEWARE: this is a slightly expensive operation so use it with care BEWARE: this is a slightly expensive operation so use it with care
</summary> </summary>
</member> </member>

View File

@ -356,6 +356,7 @@
<summary> <summary>
Checks all active tweens to find and remove eventually invalid ones (usually because their targets became NULL) Checks all active tweens to find and remove eventually invalid ones (usually because their targets became NULL)
and returns the total number of invalid tweens found and removed. and returns the total number of invalid tweens found and removed.
IMPORTANT: this will cause an error on UWP platform, so don't use it there
BEWARE: this is a slightly expensive operation so use it with care BEWARE: this is a slightly expensive operation so use it with care
</summary> </summary>
</member> </member>

View File

@ -356,6 +356,7 @@
<summary> <summary>
Checks all active tweens to find and remove eventually invalid ones (usually because their targets became NULL) Checks all active tweens to find and remove eventually invalid ones (usually because their targets became NULL)
and returns the total number of invalid tweens found and removed. and returns the total number of invalid tweens found and removed.
IMPORTANT: this will cause an error on UWP platform, so don't use it there
BEWARE: this is a slightly expensive operation so use it with care BEWARE: this is a slightly expensive operation so use it with care
</summary> </summary>
</member> </member>

View File

@ -11,8 +11,34 @@ using UnityEngine.UI;
public class TempTests : BrainBase public class TempTests : BrainBase
{ {
public void OnComplete() private int killCounter = 0;
private void Awake()
{ {
Debug.Log("ON COMPLETE"); DOTween.Init(true, true, LogBehaviour.Verbose);
DOTween.SetTweensCapacity(200, 125);
}
private void Start()
{
const float Delay = 2;
DOTween.Sequence().AppendInterval(Delay).OnKill(OnKill);
DOTween.Sequence().AppendInterval(Delay).OnKill(OnKill);
}
private void OnKill()
{
if (++killCounter == 2)
StartCoroutine(Coroutine());
}
private IEnumerator Coroutine()
{
Sequence sequence = DOTween.Sequence().AppendInterval(2).OnKill(() => { });
yield return new WaitForSeconds(1);
Debug.Log("sequence.Kill()");
sequence.Kill(); // IndexOutOfRangeException
} }
} }

View File

@ -1,2 +1,2 @@
m_EditorVersion: 5.4.0f3 m_EditorVersion: 5.4.1f1
m_StandardAssetsVersion: 0 m_StandardAssetsVersion: 0

View File

@ -319,9 +319,7 @@ namespace DG.Tweening.Core
} }
// Kill all eventually marked tweens // Kill all eventually marked tweens
if (totInvalid > 0) { if (totInvalid > 0) {
DespawnTweens(_KillList, false); DespawnActiveTweens(_KillList);
int count = _KillList.Count - 1;
for (int i = count; i > -1; --i) RemoveActiveTween(_KillList[i]);
_KillList.Clear(); _KillList.Clear();
} }
return totInvalid; return totInvalid;
@ -413,9 +411,7 @@ namespace DG.Tweening.Core
// Do not despawn tweens again, since Kill/DespawnAll was already called // Do not despawn tweens again, since Kill/DespawnAll was already called
_despawnAllCalledFromUpdateLoopCallback = false; _despawnAllCalledFromUpdateLoopCallback = false;
} else { } else {
DespawnTweens(_KillList, false); DespawnActiveTweens(_KillList);
int count = _KillList.Count - 1;
for (int i = count; i > -1; --i) RemoveActiveTween(_KillList[i]);
} }
_KillList.Clear(); _KillList.Clear();
} }
@ -833,10 +829,10 @@ namespace DG.Tweening.Core
_reorganizeFromId = -1; _reorganizeFromId = -1;
} }
static void DespawnTweens(List<Tween> tweens, bool modifyActiveLists = true) static void DespawnActiveTweens(List<Tween> tweens)
{ {
int count = tweens.Count; int count = tweens.Count - 1;
for (int i = 0; i < count; ++i) Despawn(tweens[i], modifyActiveLists); for (int i = count; i > -1; --i) Despawn(tweens[i]);
} }
// Removes a tween from the active list, reorganizes said list // Removes a tween from the active list, reorganizes said list

View File

@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween public class DOTween
{ {
/// <summary>DOTween's version</summary> /// <summary>DOTween's version</summary>
public static readonly string Version = "1.1.330"; public static readonly string Version = "1.1.340";
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Options //////////////////////////////////// // Options ////////////////////////////////////

View File

@ -356,6 +356,7 @@
<summary> <summary>
Checks all active tweens to find and remove eventually invalid ones (usually because their targets became NULL) Checks all active tweens to find and remove eventually invalid ones (usually because their targets became NULL)
and returns the total number of invalid tweens found and removed. and returns the total number of invalid tweens found and removed.
IMPORTANT: this will cause an error on UWP platform, so don't use it there
BEWARE: this is a slightly expensive operation so use it with care BEWARE: this is a slightly expensive operation so use it with care
</summary> </summary>
</member> </member>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.