diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll index aaa99f8..6ac301d 100644 Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb index 4032936..19209df 100644 Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll index 5692a8f..baff6ba 100644 Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll and b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb index 19fbbc0..7bc893d 100644 Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb and b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenUpgradeManager.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenUpgradeManager.dll index abd207d..beb1445 100644 Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenUpgradeManager.dll and b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenUpgradeManager.dll differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenUpgradeManager.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenUpgradeManager.dll.mdb index 7e5b0c5..5297baa 100644 Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenUpgradeManager.dll.mdb and b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenUpgradeManager.dll.mdb differ diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/IndexOutOfRange04.cs b/UnityTests.Unity5/Assets/_Tests/Bugs/IndexOutOfRange04.cs new file mode 100644 index 0000000..9f5946f --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/IndexOutOfRange04.cs @@ -0,0 +1,72 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +// Code to replicate by Andrey Timofeev: https://github.com/Demigiant/dotween/pull/288/files#diff-0 +public class IndexOutOfRange04 : BrainBase +{ + public static int updateCounter = -1; + + int _callCounter = 0; + + void Start() + { + Time.maximumDeltaTime = 0.02f; + DOTween.Init(true, true, LogBehaviour.Verbose); + DOTween.SetTweensCapacity(1000, 1000); + StartCoroutine(CoTest()); + } + + IEnumerator CoTest() + { + updateCounter = -1; + yield return null; + yield return null; + yield return null; + updateCounter = 0; + + StartSequence(0.75f, true); // callNumber 1 + + yield return new WaitForSeconds(0.5f); + + var t0 = StartSequence(0.75f, false); // callNumber 2 + + yield return new WaitForSeconds(0.5f); + + var t1 = StartSequence(99999f, false); // callNumber 3 + StartSequence(99999f, false); // callNumber 4 + + while (t1.active) yield return null; +// while (t0.active) yield return null; + Debug.Log("Done waiting for tween"); + + StartSequence(99999f, true); // callNumber 5 + } + + Tweener StartSequence(float duration, bool failStart) + { + int callNumber = ++_callCounter; + Debug.Log(string.Format("StartSequence, callNumber:{0} duration:{1} failStart:{2}", callNumber, duration, failStart)); + + GameObject go = new GameObject(callNumber.ToString()); + + var sequence = DOTween.Sequence(); + var tweener = go.transform.DOMoveX(callNumber + 1000, duration); + sequence.Append(tweener); + + if (failStart) { + Debug.Log(string.Format("Destroying gameobject, callNumber {0}", callNumber)); + Destroy(go); + } + + return tweener; + } + + void Update() + { +// if (updateCounter >= 0) { +// Debug.Log(string.Format("Update {0}, time: {1}", updateCounter, Time.time)); +// ++updateCounter; +// } + } +} diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/IndexOutOfRange04.cs.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/IndexOutOfRange04.cs.meta new file mode 100644 index 0000000..f0104aa --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/IndexOutOfRange04.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ccbd60edbcb37524dac83a3c0381ec1e +timeCreated: 1550946250 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/IndexOutOfRange04.unity b/UnityTests.Unity5/Assets/_Tests/Bugs/IndexOutOfRange04.unity new file mode 100644 index 0000000..efc840e Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Bugs/IndexOutOfRange04.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/IndexOutOfRange04.unity.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/IndexOutOfRange04.unity.meta new file mode 100644 index 0000000..05500b3 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/IndexOutOfRange04.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f0f1c822430a09140b2a4f0b496a99f4 +timeCreated: 1481284574 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/_DOTween.Assembly/DOTween/DOTween.cs b/_DOTween.Assembly/DOTween/DOTween.cs index db5a1a2..f919634 100644 --- a/_DOTween.Assembly/DOTween/DOTween.cs +++ b/_DOTween.Assembly/DOTween/DOTween.cs @@ -32,7 +32,7 @@ namespace DG.Tweening public class DOTween { /// DOTween's version - public static readonly string Version = "1.2.180"; // Last version before modules: 1.1.755 + public static readonly string Version = "1.2.185"; // Last version before modules: 1.1.755 /////////////////////////////////////////////// // Options //////////////////////////////////// diff --git a/_DOTween.Assembly/DOTween/Sequence.cs b/_DOTween.Assembly/DOTween/Sequence.cs index 6c2b46a..f0bc58d 100644 --- a/_DOTween.Assembly/DOTween/Sequence.cs +++ b/_DOTween.Assembly/DOTween/Sequence.cs @@ -158,10 +158,9 @@ namespace DG.Tweening // Returns TRUE in case of success internal static bool DoStartup(Sequence s) { - if (s.sequencedTweens.Count == 0 && s._sequencedObjs.Count == 0 - && s.onComplete == null && s.onKill == null && s.onPause == null && s.onPlay == null && s.onRewind == null - && s.onStart == null && s.onStepComplete == null && s.onUpdate == null - ) return false; // Empty Sequence without any callback set + if (s.sequencedTweens.Count == 0 && s._sequencedObjs.Count == 0 && !IsAnyCallbackSet(s)) { + return false; // Empty Sequence without any callback set + } s.startupDone = true; s.fullDuration = s.loops > -1 ? s.duration * s.loops : Mathf.Infinity; @@ -268,10 +267,13 @@ namespace DG.Tweening if (!t.startupDone) continue; // since we're going backwards and this tween never started just ignore it t.isBackwards = true; if (TweenManager.Goto(t, gotoPos, false, updateMode)) { - // Nested tween failed. Remove it from Sequence and continue - // (instead of just returning TRUE, which would kill the whole Sequence as before v1.2.060) + // Nested tween failed. If it's the only tween and there's no callbacks mark for killing the whole sequence + // (default behaviour in any case prior to v1.2.060)... + if (s.sequencedTweens.Count == 1 && s._sequencedObjs.Count == 1 && !IsAnyCallbackSet(s)) return true; + // ...otherwise remove failed tween from Sequence and continue TweenManager.Despawn(t, false); s._sequencedObjs.RemoveAt(i); + s.sequencedTweens.RemoveAt(i); --i; --len; continue; } @@ -323,10 +325,13 @@ namespace DG.Tweening // t.isBackwards = false; if (TweenManager.Goto(t, gotoPos, false, updateMode)) { - // Nested tween failed. Remove it from Sequence and continue - // (instead of just returning TRUE, which would kill the whole Sequence as before v1.2.060) + // Nested tween failed. If it's the only tween and there's no callbacks mark for killing the whole sequence + // (default behaviour in any case prior to v1.2.060)... + if (s.sequencedTweens.Count == 1 && s._sequencedObjs.Count == 1 && !IsAnyCallbackSet(s)) return true; + // ...otherwise remove failed tween from Sequence and continue TweenManager.Despawn(t, false); s._sequencedObjs.RemoveAt(i); + s.sequencedTweens.RemoveAt(i); --i; --len; continue; } @@ -362,6 +367,12 @@ namespace DG.Tweening } } + static bool IsAnyCallbackSet(Sequence s) + { + return s.onComplete != null || s.onKill != null || s.onPause != null || s.onPlay != null || s.onRewind != null + || s.onStart != null || s.onStepComplete != null || s.onUpdate != null; + } + // // Quicker but doesn't implement stable sort // static int SortSequencedObjs(ABSSequentiable a, ABSSequentiable b) // { diff --git a/_DOTween.Assembly/bin/DOTween.dll b/_DOTween.Assembly/bin/DOTween.dll index aaa99f8..6ac301d 100644 Binary files a/_DOTween.Assembly/bin/DOTween.dll and b/_DOTween.Assembly/bin/DOTween.dll differ diff --git a/_DOTween.Assembly/bin/DOTween.dll.mdb b/_DOTween.Assembly/bin/DOTween.dll.mdb index 4032936..19209df 100644 Binary files a/_DOTween.Assembly/bin/DOTween.dll.mdb and b/_DOTween.Assembly/bin/DOTween.dll.mdb differ diff --git a/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll index 5692a8f..baff6ba 100644 Binary files a/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll and b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll differ diff --git a/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb index 19fbbc0..7bc893d 100644 Binary files a/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb and b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb differ diff --git a/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll b/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll index abd207d..beb1445 100644 Binary files a/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll and b/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll differ diff --git a/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll.mdb b/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll.mdb index 7e5b0c5..5297baa 100644 Binary files a/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll.mdb and b/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll.mdb differ