diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML index 9d179a7..de60e84 100644 --- a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML @@ -371,6 +371,13 @@ If TRUE draws path gizmos in Unity Editor (if the gizmos button is active). Deactivate this if you want to avoid gizmos overhead while in Unity Editor + + If TRUE activates various debug options + + + Stores the target id so it can be used to give more info in case of safeMode error capturing. + Only active if both debugMode and useSafeMode are TRUE + Default updateType for new tweens. Default: UpdateType.Normal @@ -2646,6 +2653,11 @@ Tweeners-only (ignored by Sequences), returns TRUE if the tween was set as relative + + + Set by SetTarget if DOTween's Debug Mode is on (see DOTween Utility Panel -> "Store GameObject's ID" debug option + + FALSE when tween is (or should be) despawned - set only by TweenManager diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll index 93940f8..a191937 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 9bbb16c..4072235 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 ae0f232..1d4e8c2 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 0ba7f6b..4c85f54 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 ddfe0cd..467ae05 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 74661e8..eefdee1 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/Resources/DOTweenSettings.asset b/UnityTests.Unity5/Assets/Resources/DOTweenSettings.asset index 1812a99..f001dfc 100644 Binary files a/UnityTests.Unity5/Assets/Resources/DOTweenSettings.asset and b/UnityTests.Unity5/Assets/Resources/DOTweenSettings.asset differ diff --git a/UnityTests.Unity5/Assets/_Tests/DebugMode.cs b/UnityTests.Unity5/Assets/_Tests/DebugMode.cs new file mode 100644 index 0000000..60a284a --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/DebugMode.cs @@ -0,0 +1,18 @@ +using System.Collections; +using System.Collections.Generic; +using DG.Tweening; +using UnityEngine; + +public class DebugMode : BrainBase +{ + public Transform target; + + IEnumerator Start() + { + yield return new WaitForSeconds(0.5f); + + Debug.Log("Destroy target then try to create tween"); + Destroy(target.gameObject); + target.DOMoveX(2, 2); + } +} diff --git a/UnityTests.Unity5/Assets/_Tests/DebugMode.cs.meta b/UnityTests.Unity5/Assets/_Tests/DebugMode.cs.meta new file mode 100644 index 0000000..460750f --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/DebugMode.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5980181a2c06caa48af698e284f4641b +timeCreated: 1576169779 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/_Tests/DebugMode.unity b/UnityTests.Unity5/Assets/_Tests/DebugMode.unity new file mode 100644 index 0000000..07b60d8 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/DebugMode.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/DebugMode.unity.meta b/UnityTests.Unity5/Assets/_Tests/DebugMode.unity.meta new file mode 100644 index 0000000..5170470 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/DebugMode.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2c4e03937802b7745b2f0fb6fd674492 +timeCreated: 1576169761 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/_Tests/TempTests.cs b/UnityTests.Unity5/Assets/_Tests/TempTests.cs index 965b961..d5c17e5 100644 --- a/UnityTests.Unity5/Assets/_Tests/TempTests.cs +++ b/UnityTests.Unity5/Assets/_Tests/TempTests.cs @@ -11,83 +11,8 @@ using UnityEngine.UI; public class TempTests : BrainBase { - private Sequence parent; - private float duration; - - // Empty Scene with 3 cubes next to each other named Cube1, Cube2, Cube3. - // Empty game object with script on it. 2 check boxes in inspector to fire the methods. - // Child sequence is a one off. Parent sequence has a restart on complete. - // If you fire parent first, and the boxes do not adhere to the time they just fly away. - // If you fire child first, then fire parent, and the parent sequence uses times. - - void Update() + IEnumerator Start() { - if (Input.GetKeyUp(KeyCode.F5)) { - DOTween.KillAll(); - SceneManager.LoadScene(SceneManager.GetActiveScene().name); - } - - if (Input.GetKeyUp(KeyCode.DownArrow)) - { - Debug.Log("Create child"); - createChild(); - } - - if (Input.GetKeyUp(KeyCode.UpArrow)) - { - Debug.Log("Create parent"); - createParent(); - } - } - - public void createParent() - { - parent = DOTween.Sequence() - .SetAutoKill(false) - .AppendCallback(() => createChild()); - Debug.Log("- " + duration); - parent.AppendInterval(duration) - .OnComplete(() => { - Debug.Log("RESTART"); - parent.Restart(); - }); - } - - public void createChild() - { - var listy = new List - { - GameObject.Find("Cube1"), - GameObject.Find("Cube2"), - GameObject.Find("Cube3") - }; - - var child = DOTween.Sequence(); - setCallBack(listy, child); - duration = child.Duration(); - Debug.Log(">>> duration: " + duration); - } - - private void setCallBack(List listy, Sequence child) - { - foreach (var thing in listy) - { - var rand = (float)rando(); - Debug.Log("Wait " + thing.name + " " + rand.ToString()); - child.AppendCallback(() => planToMove(thing.transform)).AppendInterval(rand); // move each, append a wait interval - } - } - - public int rando() - { - var rnd = new System.Random(); - return rnd.Next(1, 5); - } - - public void planToMove(Transform thing) - { - var rand = rando(); - thing.DOMove(new Vector3(thing.position.x, thing.position.y, thing.position.z + rand), .5f); //move the z a random amount beween 1-3. - Debug.Log("Move " + thing.name + " " + rand.ToString()); + yield return new WaitForSeconds(1); } } \ No newline at end of file diff --git a/UnityTests.Unity5/ProjectSettings/ProjectVersion.txt b/UnityTests.Unity5/ProjectSettings/ProjectVersion.txt index 7fcfffd..7a59bc8 100644 --- a/UnityTests.Unity5/ProjectSettings/ProjectVersion.txt +++ b/UnityTests.Unity5/ProjectSettings/ProjectVersion.txt @@ -1 +1 @@ -m_EditorVersion: 5.6.5f1 +m_EditorVersion: 5.6.7f1 diff --git a/_DOTween.Assembly/DOTween/Core/DOTweenSettings.cs b/_DOTween.Assembly/DOTween/Core/DOTweenSettings.cs index 1347858..8f1cf57 100644 --- a/_DOTween.Assembly/DOTween/Core/DOTweenSettings.cs +++ b/_DOTween.Assembly/DOTween/Core/DOTweenSettings.cs @@ -32,6 +32,11 @@ namespace DG.Tweening.Core public bool defaultAutoKill = true; public LoopType defaultLoopType = LoopType.Restart; + // Debug + public bool debugMode = false; + // Stores the target id so it can be used to give more info in case of safeMode error capturing + public bool debugStoreTargetId = false; + // Pro-only - accessed via DOTweenAnimationInspector public bool showPreviewPanel = true; diff --git a/_DOTween.Assembly/DOTween/Core/Debugger.cs b/_DOTween.Assembly/DOTween/Core/Debugger.cs index c764cd2..353c2de 100644 --- a/_DOTween.Assembly/DOTween/Core/Debugger.cs +++ b/_DOTween.Assembly/DOTween/Core/Debugger.cs @@ -28,9 +28,20 @@ namespace DG.Tweening.Core if (DOTween.onWillLog != null && !DOTween.onWillLog(LogType.Log, message)) return; Debug.Log(message); } - public static void LogWarning(object message) + public static void LogWarning(object message, Tween t = null) { message = _LogPrefix + message; + if (DOTween.debugMode && t != null) { + bool hasDebugTargetId = t.debugTargetId != null; + bool hasStringId = t.stringId != null; + bool hasIntId = t.intId != -999; + if (hasDebugTargetId || hasStringId || hasIntId) { + message += "\n"; + if (hasDebugTargetId) message += string.Format("-[debug target ID: {0}]-", t.debugTargetId); + if (hasStringId) message += string.Format("-[stringId: {0}]-", t.stringId); + if (hasIntId) message += string.Format("-[intId: {0}]-", t.intId); + } + } if (DOTween.onWillLog != null && !DOTween.onWillLog(LogType.Warning, message)) return; Debug.LogWarning(message); } @@ -67,7 +78,7 @@ namespace DG.Tweening.Core public static void LogNestedTween(Tween t) { - LogWarning("This Tween was added to a Sequence and can't be controlled directly"); + LogWarning("This Tween was added to a Sequence and can't be controlled directly", t); } public static void LogNullTween(Tween t) @@ -77,7 +88,7 @@ namespace DG.Tweening.Core public static void LogNonPathTween(Tween t) { - LogWarning("This Tween is not a path tween"); + LogWarning("This Tween is not a path tween", t); } public static void LogMissingMaterialProperty(string propertyName) @@ -89,14 +100,18 @@ namespace DG.Tweening.Core LogWarning(string.Format("This material doesn't have a {0} property ID", propertyId)); } - public static void LogRemoveActiveTweenError(string errorInfo) + public static void LogRemoveActiveTweenError(string errorInfo, Tween t) { - LogWarning(string.Format("Error in RemoveActiveTween ({0}). It's been taken care of so no problems, but Daniele (DOTween's author) is trying to pinpoint it (it's very rare and he can't reproduce it) so it would be awesome if you could reproduce this log in a sample project and send it to him. Or even just write him the complete log that was generated by this message. Fixing this would make DOTween slightly faster. Thanks.", errorInfo)); + LogWarning(string.Format( + "Error in RemoveActiveTween ({0}). It's been taken care of so no problems, but Daniele (DOTween's author) is trying to pinpoint it (it's very rare and he can't reproduce it) so it would be awesome if you could reproduce this log in a sample project and send it to him. Or even just write him the complete log that was generated by this message. Fixing this would make DOTween slightly faster. Thanks.", errorInfo + ), t); } - public static void LogAddActiveTweenError(string errorInfo) + public static void LogAddActiveTweenError(string errorInfo, Tween t) { - LogWarning(string.Format("Error in AddActiveTween ({0}). It's been taken care of so no problems, but Daniele (DOTween's author) is trying to pinpoint it (it's very rare and he can't reproduce it) so it would be awesome if you could reproduce this log in a sample project and send it to him. Or even just write him the complete log that was generated by this message. Fixing this would make DOTween slightly faster. Thanks.", errorInfo)); + LogWarning(string.Format( + "Error in AddActiveTween ({0}). It's been taken care of so no problems, but Daniele (DOTween's author) is trying to pinpoint it (it's very rare and he can't reproduce it) so it would be awesome if you could reproduce this log in a sample project and send it to him. Or even just write him the complete log that was generated by this message. Fixing this would make DOTween slightly faster. Thanks.", errorInfo + ), t); } public static void SetLogPriority(LogBehaviour logBehaviour) diff --git a/_DOTween.Assembly/DOTween/Core/TweenManager.cs b/_DOTween.Assembly/DOTween/Core/TweenManager.cs index d84ebb0..09828fc 100644 --- a/_DOTween.Assembly/DOTween/Core/TweenManager.cs +++ b/_DOTween.Assembly/DOTween/Core/TweenManager.cs @@ -229,7 +229,7 @@ namespace DG.Tweening.Core internal static void Despawn(Tween t, bool modifyActiveLists = true) { // Callbacks - if (t.onKill != null) Tween.OnTweenCallback(t.onKill); + if (t.onKill != null) Tween.OnTweenCallback(t.onKill, t); if (modifyActiveLists) { // Remove tween from active list @@ -295,7 +295,7 @@ namespace DG.Tweening.Core Tween t = _activeTweens[i]; if (t != null && t.active) { t.active = false; - if (t.onKill != null) Tween.OnTweenCallback(t.onKill); + if (t.onKill != null) Tween.OnTweenCallback(t.onKill, t); } } @@ -436,7 +436,7 @@ namespace DG.Tweening.Core // Delay elapsed - call OnPlay if required if (t.playedOnce && t.onPlay != null) { // Don't call in case it hasn't started because onStart routine will call it - Tween.OnTweenCallback(t.onPlay); + Tween.OnTweenCallback(t.onPlay, t); } } // Startup (needs to be here other than in Tween.DoGoto in case of speed-based tweens, to calculate duration correctly) @@ -704,7 +704,7 @@ namespace DG.Tweening.Core } else if (toPosition >= t.duration) toPosition = 0; // If andPlay is FALSE manage onPause from here because DoGoto won't detect it (since t.isPlaying was already set from here) bool needsKilling = Tween.DoGoto(t, toPosition, toCompletedLoops, updateMode); - if (!andPlay && wasPlaying && !needsKilling && t.onPause != null) Tween.OnTweenCallback(t.onPause); + if (!andPlay && wasPlaying && !needsKilling && t.onPause != null) Tween.OnTweenCallback(t.onPause, t); return needsKilling; } @@ -713,7 +713,7 @@ namespace DG.Tweening.Core { if (t.isPlaying) { t.isPlaying = false; - if (t.onPause != null) Tween.OnTweenCallback(t.onPause); + if (t.onPause != null) Tween.OnTweenCallback(t.onPause, t); return true; } return false; @@ -726,7 +726,7 @@ namespace DG.Tweening.Core t.isPlaying = true; if (t.playedOnce && t.delayComplete && t.onPlay != null) { // Don't call in case there's a delay to run or if it hasn't started because onStart routine will call it - Tween.OnTweenCallback(t.onPlay); + Tween.OnTweenCallback(t.onPlay, t); } return true; } @@ -774,7 +774,7 @@ namespace DG.Tweening.Core t.isPlaying = true; if (wasPaused && t.playedOnce && t.delayComplete && t.onPlay != null) { // Don't call in case there's a delay to run or if it hasn't started because onStart routine will call it - Tween.OnTweenCallback(t.onPlay); + Tween.OnTweenCallback(t.onPlay, t); } return true; } @@ -798,7 +798,7 @@ namespace DG.Tweening.Core if (t.position > 0 || t.completedLoops > 0 || !t.startupDone) { rewinded = true; bool needsKilling = Tween.DoGoto(t, 0, 0, UpdateMode.Goto); - if (!needsKilling && wasPlaying && t.onPause != null) Tween.OnTweenCallback(t.onPause); + if (!needsKilling && wasPlaying && t.onPause != null) Tween.OnTweenCallback(t.onPause, t); } else { // Alread rewinded ManageOnRewindCallbackWhenAlreadyRewinded(t, false); @@ -998,7 +998,7 @@ namespace DG.Tweening.Core // Safety check (IndexOutOfRangeException) if (totActiveTweens < 0) { - Debugger.LogAddActiveTweenError("totActiveTweens < 0"); + Debugger.LogAddActiveTweenError("totActiveTweens < 0", t); totActiveTweens = 0; } // else if (totActiveTweens > _activeTweens.Length - 1) { @@ -1093,7 +1093,7 @@ namespace DG.Tweening.Core totActiveDefaultTweens--; hasActiveDefaultTweens = totActiveDefaultTweens > 0; } else { - Debugger.LogRemoveActiveTweenError("totActiveDefaultTweens < 0"); + Debugger.LogRemoveActiveTweenError("totActiveDefaultTweens < 0", t); } } else { switch (t.updateType) { @@ -1103,7 +1103,7 @@ namespace DG.Tweening.Core totActiveFixedTweens--; hasActiveFixedTweens = totActiveFixedTweens > 0; } else { - Debugger.LogRemoveActiveTweenError("totActiveFixedTweens < 0"); + Debugger.LogRemoveActiveTweenError("totActiveFixedTweens < 0", t); } break; case UpdateType.Late: @@ -1112,7 +1112,7 @@ namespace DG.Tweening.Core totActiveLateTweens--; hasActiveLateTweens = totActiveLateTweens > 0; } else { - Debugger.LogRemoveActiveTweenError("totActiveLateTweens < 0"); + Debugger.LogRemoveActiveTweenError("totActiveLateTweens < 0", t); } break; default: @@ -1121,7 +1121,7 @@ namespace DG.Tweening.Core totActiveManualTweens--; hasActiveManualTweens = totActiveManualTweens > 0; } else { - Debugger.LogRemoveActiveTweenError("totActiveManualTweens < 0"); + Debugger.LogRemoveActiveTweenError("totActiveManualTweens < 0", t); } break; } @@ -1133,17 +1133,17 @@ namespace DG.Tweening.Core // Safety check (IndexOutOfRangeException) if (totActiveTweens < 0) { totActiveTweens = 0; - Debugger.LogRemoveActiveTweenError("totActiveTweens < 0"); + Debugger.LogRemoveActiveTweenError("totActiveTweens < 0", t); } // Safety check (IndexOutOfRangeException) if (totActiveTweeners < 0) { totActiveTweeners = 0; - Debugger.LogRemoveActiveTweenError("totActiveTweeners < 0"); + Debugger.LogRemoveActiveTweenError("totActiveTweeners < 0", t); } // Safety check (IndexOutOfRangeException) if (totActiveSequences < 0) { totActiveSequences = 0; - Debugger.LogRemoveActiveTweenError("totActiveSequences < 0"); + Debugger.LogRemoveActiveTweenError("totActiveSequences < 0", t); } } diff --git a/_DOTween.Assembly/DOTween/Core/TweenerCore.cs b/_DOTween.Assembly/DOTween/Core/TweenerCore.cs index 8ee9fac..642bbc6 100644 --- a/_DOTween.Assembly/DOTween/Core/TweenerCore.cs +++ b/_DOTween.Assembly/DOTween/Core/TweenerCore.cs @@ -52,7 +52,7 @@ namespace DG.Tweening.Core public override Tweener ChangeStartValue(object newStartValue, float newDuration = -1) { if (isSequenced) { - if (Debugger.logPriority >= 1) Debugger.LogWarning(_TxtCantChangeSequencedValues); + if (Debugger.logPriority >= 1) Debugger.LogWarning(_TxtCantChangeSequencedValues, this); return this; } #if COMPATIBLE @@ -60,7 +60,7 @@ namespace DG.Tweening.Core #endif Type valT = newStartValue.GetType(); if (valT != typeofT2) { - if (Debugger.logPriority >= 1) Debugger.LogWarning("ChangeStartValue: incorrect newStartValue type (is " + valT + ", should be " + typeofT2 + ")"); + if (Debugger.logPriority >= 1) Debugger.LogWarning("ChangeStartValue: incorrect newStartValue type (is " + valT + ", should be " + typeofT2 + ")", this); return this; } return DoChangeStartValue(this, (T2)newStartValue, newDuration); @@ -73,7 +73,7 @@ namespace DG.Tweening.Core public override Tweener ChangeEndValue(object newEndValue, float newDuration = -1, bool snapStartValue = false) { if (isSequenced) { - if (Debugger.logPriority >= 1) Debugger.LogWarning(_TxtCantChangeSequencedValues); + if (Debugger.logPriority >= 1) Debugger.LogWarning(_TxtCantChangeSequencedValues, this); return this; } #if COMPATIBLE @@ -81,7 +81,7 @@ namespace DG.Tweening.Core #endif Type valT = newEndValue.GetType(); if (valT != typeofT2) { - if (Debugger.logPriority >= 1) Debugger.LogWarning("ChangeEndValue: incorrect newEndValue type (is " + valT + ", should be " + typeofT2 + ")"); + if (Debugger.logPriority >= 1) Debugger.LogWarning("ChangeEndValue: incorrect newEndValue type (is " + valT + ", should be " + typeofT2 + ")", this); return this; } return DoChangeEndValue(this, (T2)newEndValue, newDuration, snapStartValue); @@ -91,7 +91,7 @@ namespace DG.Tweening.Core public override Tweener ChangeValues(object newStartValue, object newEndValue, float newDuration = -1) { if (isSequenced) { - if (Debugger.logPriority >= 1) Debugger.LogWarning(_TxtCantChangeSequencedValues); + if (Debugger.logPriority >= 1) Debugger.LogWarning(_TxtCantChangeSequencedValues, this); return this; } #if COMPATIBLE @@ -101,11 +101,11 @@ namespace DG.Tweening.Core Type valT0 = newStartValue.GetType(); Type valT1 = newEndValue.GetType(); if (valT0 != typeofT2) { - if (Debugger.logPriority >= 1) Debugger.LogWarning("ChangeValues: incorrect value type (is " + valT0 + ", should be " + typeofT2 + ")"); + if (Debugger.logPriority >= 1) Debugger.LogWarning("ChangeValues: incorrect value type (is " + valT0 + ", should be " + typeofT2 + ")", this); return this; } if (valT1 != typeofT2) { - if (Debugger.logPriority >= 1) Debugger.LogWarning("ChangeValues: incorrect value type (is " + valT1 + ", should be " + typeofT2 + ")"); + if (Debugger.logPriority >= 1) Debugger.LogWarning("ChangeValues: incorrect value type (is " + valT1 + ", should be " + typeofT2 + ")", this); return this; } return DoChangeValues(this, (T2)newStartValue, (T2)newEndValue, newDuration); @@ -120,7 +120,7 @@ namespace DG.Tweening.Core public TweenerCore ChangeStartValue(T2 newStartValue, float newDuration = -1) { if (isSequenced) { - if (Debugger.logPriority >= 1) Debugger.LogWarning(_TxtCantChangeSequencedValues); + if (Debugger.logPriority >= 1) Debugger.LogWarning(_TxtCantChangeSequencedValues, this); return this; } return DoChangeStartValue(this, newStartValue, newDuration); @@ -140,7 +140,7 @@ namespace DG.Tweening.Core public TweenerCore ChangeEndValue(T2 newEndValue, float newDuration = -1, bool snapStartValue = false) { if (isSequenced) { - if (Debugger.logPriority >= 1) Debugger.LogWarning(_TxtCantChangeSequencedValues); + if (Debugger.logPriority >= 1) Debugger.LogWarning(_TxtCantChangeSequencedValues, this); return this; } return DoChangeEndValue(this, newEndValue, newDuration, snapStartValue); @@ -154,7 +154,7 @@ namespace DG.Tweening.Core public TweenerCore ChangeValues(T2 newStartValue, T2 newEndValue, float newDuration = -1) { if (isSequenced) { - if (Debugger.logPriority >= 1) Debugger.LogWarning(_TxtCantChangeSequencedValues); + if (Debugger.logPriority >= 1) Debugger.LogWarning(_TxtCantChangeSequencedValues, this); return this; } return DoChangeValues(this, newStartValue, newEndValue, newDuration); diff --git a/_DOTween.Assembly/DOTween/DOTween.cs b/_DOTween.Assembly/DOTween/DOTween.cs index 7fbdb29..b9878a7 100644 --- a/_DOTween.Assembly/DOTween/DOTween.cs +++ b/_DOTween.Assembly/DOTween/DOTween.cs @@ -34,7 +34,7 @@ namespace DG.Tweening public class DOTween { /// DOTween's version - public static readonly string Version = "1.2.305"; // Last version before modules: 1.1.755 + public static readonly string Version = "1.2.310"; // Last version before modules: 1.1.755 /////////////////////////////////////////////// // Options //////////////////////////////////// @@ -82,6 +82,16 @@ namespace DG.Tweening /// If TRUE draws path gizmos in Unity Editor (if the gizmos button is active). /// Deactivate this if you want to avoid gizmos overhead while in Unity Editor public static bool drawGizmos = true; + // DEBUG OPTIONS + /// If TRUE activates various debug options + public static bool debugMode = false; + /// Stores the target id so it can be used to give more info in case of safeMode error capturing. + /// Only active if both debugMode and useSafeMode are TRUE + public static bool debugStoreTargetId { + get { return debugMode && useSafeMode && _fooDebugStoreTargetId; } + set { _fooDebugStoreTargetId = value; } + } + static bool _fooDebugStoreTargetId = false; /////////////////////////////////////////////// // Default options for Tweens ///////////////// @@ -195,6 +205,9 @@ namespace DG.Tweening DOTween.defaultEasePeriod = settings.defaultEasePeriod; DOTween.defaultAutoKill = settings.defaultAutoKill; DOTween.defaultLoopType = settings.defaultLoopType; + // Debug options + DOTween.debugMode = settings.debugMode; + DOTween.debugStoreTargetId = settings.debugStoreTargetId; } // Log if (Debugger.logPriority >= 2) Debugger.Log("DOTween initialization (useSafeMode: " + DOTween.useSafeMode + ", recycling: " + (DOTween.defaultRecyclable ? "ON" : "OFF") + ", logBehaviour: " + DOTween.logBehaviour + ")"); diff --git a/_DOTween.Assembly/DOTween/Plugins/PathPlugin.cs b/_DOTween.Assembly/DOTween/Plugins/PathPlugin.cs index 1b86594..0d33e6e 100644 --- a/_DOTween.Assembly/DOTween/Plugins/PathPlugin.cs +++ b/_DOTween.Assembly/DOTween/Plugins/PathPlugin.cs @@ -146,12 +146,12 @@ namespace DG.Tweening.Plugins } if (isBackwards) { // for (int i = prevWPIndex - 1; i > newWaypointIndex - 1; --i) Tween.OnTweenCallback(t.onWaypointChange, i); - for (int i = prevWPIndex - 1; i > newWaypointIndex - 1; --i) Tween.OnTweenCallback(t.onWaypointChange, i); + for (int i = prevWPIndex - 1; i > newWaypointIndex - 1; --i) Tween.OnTweenCallback(t.onWaypointChange, t, i); } else { // for (int i = prevWPIndex + 1; i < newWaypointIndex + 1; ++i) Tween.OnTweenCallback(t.onWaypointChange, i); - for (int i = prevWPIndex + 1; i < newWaypointIndex; ++i) Tween.OnTweenCallback(t.onWaypointChange, i); + for (int i = prevWPIndex + 1; i < newWaypointIndex; ++i) Tween.OnTweenCallback(t.onWaypointChange, t, i); } - Tween.OnTweenCallback(t.onWaypointChange, newWaypointIndex); + Tween.OnTweenCallback(t.onWaypointChange, t, newWaypointIndex); } } } diff --git a/_DOTween.Assembly/DOTween/Sequence.cs b/_DOTween.Assembly/DOTween/Sequence.cs index 57667c2..94d8910 100644 --- a/_DOTween.Assembly/DOTween/Sequence.cs +++ b/_DOTween.Assembly/DOTween/Sequence.cs @@ -258,7 +258,7 @@ namespace DG.Tweening if (sequentiable.tweenType == TweenType.Callback) { if (updateMode == UpdateMode.Update && prevPosIsInverse) { // Debug.Log("BACKWARDS Callback > " + s.id + " - s.isBackwards: " + s.isBackwards + ", useInverse/prevInverse: " + useInverse + "/" + prevPosIsInverse + " - " + fromPos + " > " + toPos + ""); - OnTweenCallback(sequentiable.onStart); + OnTweenCallback(sequentiable.onStart, s); } } else { // Nested Tweener/Sequence @@ -313,7 +313,7 @@ namespace DG.Tweening // Debug.Log("FORWARD Callback > " + s.id + " - s.isBackwards: " + s.isBackwards + ", useInverse/prevInverse: " + useInverse + "/" + prevPosIsInverse + " - " + fromPos + " > " + toPos + ""); bool fire = !s.isBackwards && !useInverse && !prevPosIsInverse || s.isBackwards && useInverse && !prevPosIsInverse; - if (fire) OnTweenCallback(sequentiable.onStart); + if (fire) OnTweenCallback(sequentiable.onStart, s); } } else { // Nested Tweener/Sequence diff --git a/_DOTween.Assembly/DOTween/Tween.cs b/_DOTween.Assembly/DOTween/Tween.cs index 925cdc5..c3c8b82 100644 --- a/_DOTween.Assembly/DOTween/Tween.cs +++ b/_DOTween.Assembly/DOTween/Tween.cs @@ -78,6 +78,12 @@ namespace DG.Tweening public float easePeriod; // Public so it can be used with custom plugins #pragma warning restore 1591 + // SPECIAL DEBUG DATA //////////////////////////////////////////////// + /// + /// Set by SetTarget if DOTween's Debug Mode is on (see DOTween Utility Panel -> "Store GameObject's ID" debug option + /// + public string debugTargetId; + // SETUP DATA //////////////////////////////////////////////// internal Type typeofT1; // Only used by Tweeners @@ -125,6 +131,8 @@ namespace DG.Tweening onStart = onPlay = onRewind = onUpdate = onComplete = onStepComplete = onKill = null; onWaypointChange = null; + debugTargetId = null; + target = null; isFrom = false; isBlendable = false; @@ -197,11 +205,11 @@ namespace DG.Tweening if (!t.playedOnce && updateMode == UpdateMode.Update) { t.playedOnce = true; if (t.onStart != null) { - OnTweenCallback(t.onStart); + OnTweenCallback(t.onStart, t); if (!t.active) return true; // Tween might have been killed by onStart callback } if (t.onPlay != null) { - OnTweenCallback(t.onPlay); + OnTweenCallback(t.onPlay, t); if (!t.active) return true; // Tween might have been killed by onPlay callback } } @@ -253,19 +261,19 @@ namespace DG.Tweening // Additional callbacks if (t.onUpdate != null && updateMode != UpdateMode.IgnoreOnUpdate) { - OnTweenCallback(t.onUpdate); + OnTweenCallback(t.onUpdate, t); } if (t.position <= 0 && t.completedLoops <= 0 && !wasRewinded && t.onRewind != null) { - OnTweenCallback(t.onRewind); + OnTweenCallback(t.onRewind, t); } if (newCompletedSteps > 0 && updateMode == UpdateMode.Update && t.onStepComplete != null) { - for (int i = 0; i < newCompletedSteps; ++i) OnTweenCallback(t.onStepComplete); + for (int i = 0; i < newCompletedSteps; ++i) OnTweenCallback(t.onStepComplete, t); } if (t.isComplete && !wasComplete && updateMode != UpdateMode.IgnoreOnComplete && t.onComplete != null) { - OnTweenCallback(t.onComplete); + OnTweenCallback(t.onComplete, t); } if (!t.isPlaying && wasPlaying && (!t.isComplete || !t.autoKill) && t.onPause != null) { - OnTweenCallback(t.onPause); + OnTweenCallback(t.onPause, t); } // Return @@ -274,7 +282,7 @@ namespace DG.Tweening // Assumes that the callback exists (because it was previously checked). // Returns TRUE in case of success, FALSE in case of error (if safeMode is on) - internal static bool OnTweenCallback(TweenCallback callback) + internal static bool OnTweenCallback(TweenCallback callback, Tween t) { if (DOTween.useSafeMode) { try { @@ -283,7 +291,7 @@ namespace DG.Tweening if (Debugger.logPriority >= 1) { Debugger.LogWarning(string.Format( "An error inside a tween callback was silently taken care of ({0}) ► {1}\n\n{2}\n\n", e.TargetSite, e.Message, e.StackTrace - )); + ), t); } DOTween.safeModeReport.Add(SafeModeReport.SafeModeReportType.Callback); return false; // Callback error @@ -291,7 +299,7 @@ namespace DG.Tweening } else callback(); return true; } - internal static bool OnTweenCallback(TweenCallback callback, T param) + internal static bool OnTweenCallback(TweenCallback callback, Tween t, T param) { if (DOTween.useSafeMode) { try { @@ -300,7 +308,7 @@ namespace DG.Tweening if (Debugger.logPriority >= 1) { Debugger.LogWarning(string.Format( "An error inside a tween callback was silently taken care of ({0}) ► {1}", e.TargetSite, e.Message - )); + ), t); } DOTween.safeModeReport.Add(SafeModeReport.SafeModeReportType.Callback); return false; // Callback error diff --git a/_DOTween.Assembly/DOTween/TweenExtensions.cs b/_DOTween.Assembly/DOTween/TweenExtensions.cs index a6430ca..166e35a 100644 --- a/_DOTween.Assembly/DOTween/TweenExtensions.cs +++ b/_DOTween.Assembly/DOTween/TweenExtensions.cs @@ -574,7 +574,7 @@ namespace DG.Tweening if (pathTween == null) { if (Debugger.logPriority > 1) Debugger.LogNonPathTween(t); return Vector3.zero; } else if (!pathTween.endValue.isFinalized) { - if (Debugger.logPriority > 1) Debugger.LogWarning("The path is not finalized yet"); return Vector3.zero; + if (Debugger.logPriority > 1) Debugger.LogWarning("The path is not finalized yet", t); return Vector3.zero; } return pathTween.endValue.GetPoint(pathPercentage, true); @@ -603,7 +603,7 @@ namespace DG.Tweening if (pathTween == null) { if (Debugger.logPriority > 1) Debugger.LogNonPathTween(t); return null; } else if (!pathTween.endValue.isFinalized) { - if (Debugger.logPriority > 1) Debugger.LogWarning("The path is not finalized yet"); return null; + if (Debugger.logPriority > 1) Debugger.LogWarning("The path is not finalized yet", t); return null; } return Path.GetDrawPoints(pathTween.endValue, subdivisionsXSegment); @@ -629,7 +629,7 @@ namespace DG.Tweening if (pathTween == null) { if (Debugger.logPriority > 1) Debugger.LogNonPathTween(t); return -1; } else if (!pathTween.endValue.isFinalized) { - if (Debugger.logPriority > 1) Debugger.LogWarning("The path is not finalized yet"); return -1; + if (Debugger.logPriority > 1) Debugger.LogWarning("The path is not finalized yet", t); return -1; } return pathTween.endValue.length; diff --git a/_DOTween.Assembly/DOTween/TweenSettingsExtensions.cs b/_DOTween.Assembly/DOTween/TweenSettingsExtensions.cs index f6975cb..bc70bfc 100644 --- a/_DOTween.Assembly/DOTween/TweenSettingsExtensions.cs +++ b/_DOTween.Assembly/DOTween/TweenSettingsExtensions.cs @@ -117,6 +117,10 @@ namespace DG.Tweening { if (t == null || !t.active) return t; + if (DOTween.debugStoreTargetId) { + Component comp = target as Component; + t.debugTargetId = comp != null ? comp.name : target.ToString(); + } t.target = target; return t; } diff --git a/_DOTween.Assembly/DOTween/Tweener.cs b/_DOTween.Assembly/DOTween/Tweener.cs index ec37609..c7f5c26 100644 --- a/_DOTween.Assembly/DOTween/Tweener.cs +++ b/_DOTween.Assembly/DOTween/Tweener.cs @@ -137,7 +137,7 @@ namespace DG.Tweening if (Debugger.logPriority >= 1) { Debugger.LogWarning(string.Format( "Tween startup failed (NULL target/property - {0}): the tween will now be killed ► {1}", e.TargetSite, e.Message - )); + ), t); } DOTween.safeModeReport.Add(SafeModeReport.SafeModeReportType.StartupFailure); return false; // Target/field doesn't exist: kill tween diff --git a/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindow.cs b/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindow.cs index 4ee71f0..9958207 100644 --- a/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindow.cs +++ b/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindow.cs @@ -16,7 +16,7 @@ namespace DG.DOTweenEditor.UI static void ShowWindow() { Open(); } const string _Title = "DOTween Utility Panel"; - static readonly Vector2 _WinSize = new Vector2(370,600); + static readonly Vector2 _WinSize = new Vector2(370,650); public const string Id = "DOTweenVersion"; public const string IdPro = "DOTweenProVersion"; static readonly float _HalfBtSize = _WinSize.x * 0.5f - 6; @@ -27,6 +27,7 @@ namespace DG.DOTweenEditor.UI Vector2 _headerSize, _footerSize; string _innerTitle; bool _setupRequired; + Vector2 _scrollVal; int _selectedTab; string[] _tabLabels = new[] { "Setup", "Preferences" }; @@ -112,6 +113,7 @@ namespace DG.DOTweenEditor.UI GUILayout.Space(40); GUILayout.EndHorizontal(); } else { + _scrollVal = GUILayout.BeginScrollView(_scrollVal); if (_src.modules.showPanel) { if (DOTweenUtilityWindowModules.Draw(this, _src)) { _setupRequired = EditorUtils.DOTweenSetupRequired(); @@ -134,6 +136,7 @@ namespace DG.DOTweenEditor.UI break; } } + GUILayout.EndScrollView(); } if (GUI.changed) EditorUtility.SetDirty(_src); @@ -199,14 +202,12 @@ namespace DG.DOTweenEditor.UI GUI.color = Color.white; GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); -// GUILayout.BeginVertical(GUI.skin.box); GUILayout.Label( "ASMDEFs are useful if you need to reference the extra DOTween modules API (like [UIelement].DOColor)" + " from other ASMDEFs/Libraries instead of loose scripts," + " but remember to have those ASMDEFs/Libraries reference DOTween ones.", EditorGUIUtils.wordWrapRichTextLabelStyle ); -// GUILayout.EndVertical(); GUILayout.Space(3); GUILayout.BeginHorizontal(); @@ -248,6 +249,8 @@ namespace DG.DOTweenEditor.UI _src.defaultEasePeriod = 0; _src.defaultAutoKill = true; _src.defaultLoopType = LoopType.Restart; + _src.debugMode = false; + _src.debugStoreTargetId = false; EditorUtility.SetDirty(_src); } GUILayout.Space(8); @@ -299,6 +302,21 @@ namespace DG.DOTweenEditor.UI _src.defaultEasePeriod = EditorGUILayout.FloatField("Ease Period", _src.defaultEasePeriod); _src.defaultAutoKill = EditorGUILayout.Toggle("AutoKill", _src.defaultAutoKill); _src.defaultLoopType = (LoopType)EditorGUILayout.EnumPopup("Loop Type", _src.defaultLoopType); + GUILayout.Space(8); + _src.debugMode = EditorGUIUtils.ToggleButton(_src.debugMode, new GUIContent("DEBUG MODE", "Turns debug mode options on/off"), true); + if (_src.debugMode) { + GUILayout.BeginVertical(GUI.skin.box); + EditorGUI.BeginDisabledGroup(!_src.useSafeMode && _src.logBehaviour != LogBehaviour.ErrorsOnly); + _src.debugStoreTargetId = EditorGUILayout.Toggle("Store GameObject's ID", _src.debugStoreTargetId); + GUILayout.Label( + "Requires Safe Mode to be active + Default or Verbose LogBehaviour:" + + " when using DO shortcuts stores the relative gameObject's name so it can be returned along the warning logs" + + " (helps with a clearer identification of the warning's target)", + EditorGUIUtils.wordWrapRichTextLabelStyle + ); + EditorGUI.EndDisabledGroup(); + GUILayout.EndVertical(); + } } // =================================================================================== diff --git a/_DOTween.Assembly/DOTweenEditor/UI/EditorGUIUtils.cs b/_DOTween.Assembly/DOTweenEditor/UI/EditorGUIUtils.cs index 427f484..a4a1043 100644 --- a/_DOTween.Assembly/DOTweenEditor/UI/EditorGUIUtils.cs +++ b/_DOTween.Assembly/DOTweenEditor/UI/EditorGUIUtils.cs @@ -101,10 +101,10 @@ namespace DG.DOTweenEditor.UI } // A button which works as a toggle - public static bool ToggleButton(bool toggled, GUIContent content, GUIStyle guiStyle = null, params GUILayoutOption[] options) + public static bool ToggleButton(bool toggled, GUIContent content, bool alert = false, GUIStyle guiStyle = null, params GUILayoutOption[] options) { Color orColor = UnityEngine.GUI.backgroundColor; - UnityEngine.GUI.backgroundColor = toggled ? Color.green : Color.white; + UnityEngine.GUI.backgroundColor = toggled ? alert ? Color.red : Color.green : Color.white; bool clicked = guiStyle == null ? GUILayout.Button(content, options) : GUILayout.Button(content, guiStyle, options); diff --git a/_DOTween.Assembly/bin/DOTween.XML b/_DOTween.Assembly/bin/DOTween.XML index 9d179a7..de60e84 100644 --- a/_DOTween.Assembly/bin/DOTween.XML +++ b/_DOTween.Assembly/bin/DOTween.XML @@ -371,6 +371,13 @@ If TRUE draws path gizmos in Unity Editor (if the gizmos button is active). Deactivate this if you want to avoid gizmos overhead while in Unity Editor + + If TRUE activates various debug options + + + Stores the target id so it can be used to give more info in case of safeMode error capturing. + Only active if both debugMode and useSafeMode are TRUE + Default updateType for new tweens. Default: UpdateType.Normal @@ -2646,6 +2653,11 @@ Tweeners-only (ignored by Sequences), returns TRUE if the tween was set as relative + + + Set by SetTarget if DOTween's Debug Mode is on (see DOTween Utility Panel -> "Store GameObject's ID" debug option + + FALSE when tween is (or should be) despawned - set only by TweenManager diff --git a/_DOTween.Assembly/bin/DOTween.dll b/_DOTween.Assembly/bin/DOTween.dll index 93940f8..a191937 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 9bbb16c..4072235 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 ae0f232..1d4e8c2 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 0ba7f6b..4c85f54 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 ddfe0cd..467ae05 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 74661e8..eefdee1 100644 Binary files a/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll.mdb and b/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll.mdb differ