mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2026-02-06 15:24:57 +08:00
[CHANGE] If a nested tween fails, the parent Sequence will now just remove it and go on, instead of killing itself
This commit is contained in:
parent
e0ef96323e
commit
5d29618545
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>DOTweenUpgradeManager</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:DG.DOTweenUpgradeManager.Autorun">
|
||||
<summary>
|
||||
This class and its whole library are deleted the first time DOTween's setup is run after an upgrade (or after a new install).
|
||||
NOTE: DidReloadScripts doesn't work on first install so it's useless, InitializeOnLoad is the only way
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
Binary file not shown.
Binary file not shown.
69
UnityTests.Unity5/Assets/_Tests/EmptySequences.cs
Normal file
69
UnityTests.Unity5/Assets/_Tests/EmptySequences.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
|
||||
public class EmptySequences : BrainBase
|
||||
{
|
||||
public Transform target;
|
||||
public bool nullifyTarget = false;
|
||||
public bool createSequenceA, createSequenceB, createTweenT;
|
||||
public bool appendAToParent, appendBToParent, appendTToParent;
|
||||
public int loopParent = 1;
|
||||
public LoopType loopType = LoopType.Restart;
|
||||
|
||||
IEnumerator Start()
|
||||
{
|
||||
if (nullifyTarget) target = null;
|
||||
|
||||
yield return new WaitForSeconds(0.75f);
|
||||
|
||||
Sequence a = null;
|
||||
Sequence b = null;
|
||||
Tween t = null;
|
||||
|
||||
if (createSequenceA) {
|
||||
a = DOTween.Sequence()
|
||||
.AppendCallback(() => Debug.Log("A callback 1/2"))
|
||||
// .AppendInterval(1f)
|
||||
.AppendCallback(() => Debug.Log("A callback 2/2 (1 sec delay)"))
|
||||
.OnStart(() => Debug.Log("A OnStart"))
|
||||
.OnStepComplete(() => Debug.Log("A OnStepComplete"))
|
||||
.OnComplete(() => Debug.Log("A OnComplete"))
|
||||
.OnKill(() => Debug.Log("A OnKill"));
|
||||
}
|
||||
if (createSequenceB) {
|
||||
b = DOTween.Sequence()
|
||||
.Append(target.DOMoveX(3, 0))
|
||||
.OnStart(() => Debug.Log("B OnStart"))
|
||||
.OnStepComplete(() => Debug.Log("B OnStepComplete"))
|
||||
.OnComplete(() => Debug.Log("B OnComplete"))
|
||||
.OnKill(() => Debug.Log("B OnKill"));
|
||||
}
|
||||
if (createTweenT) {
|
||||
t = target.DOMoveY(3, 0)
|
||||
.OnStart(() => Debug.Log("T OnStart"))
|
||||
.OnStepComplete(() => Debug.Log("T OnStepComplete"))
|
||||
.OnComplete(() => Debug.Log("T OnComplete"))
|
||||
.OnKill(() => Debug.Log("T OnKill"));
|
||||
}
|
||||
if (appendAToParent || appendBToParent || appendTToParent) {
|
||||
Sequence parent = DOTween.Sequence();
|
||||
if (a != null && appendAToParent) parent.Append(a);
|
||||
if (b != null && appendBToParent) parent.Append(b);
|
||||
if (t != null && appendTToParent) parent.Append(t);
|
||||
if (loopParent > 1 || loopParent == -1) parent.SetLoops(loopParent, loopType);
|
||||
parent
|
||||
// .AppendInterval(1f)
|
||||
.AppendCallback(() => Debug.Log("PARENT callback 1/3 (1 sec delay)"))
|
||||
// .AppendInterval(1f)
|
||||
.AppendCallback(() => Debug.Log("PARENT callback 2/3 (1 sec delay after prev)"))
|
||||
// .AppendInterval(0.0001f)
|
||||
.AppendCallback(() => Debug.Log("PARENT callback 3/3 (0.0001 sec delay after prev, right at end of Sequence)"))
|
||||
.OnStart(() => Debug.Log("PARENT OnStart"))
|
||||
.OnStepComplete(() => Debug.Log("PARENT OnStepComplete"))
|
||||
.OnComplete(() => Debug.Log("PARENT OnComplete"))
|
||||
.OnKill(() => Debug.Log("PARENT OnKill"));
|
||||
}
|
||||
}
|
||||
}
|
||||
12
UnityTests.Unity5/Assets/_Tests/EmptySequences.cs.meta
Normal file
12
UnityTests.Unity5/Assets/_Tests/EmptySequences.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c3a362fa0006da44a5b890fc1f85e47
|
||||
timeCreated: 1533629018
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
UnityTests.Unity5/Assets/_Tests/EmptySequences.unity
Normal file
BIN
UnityTests.Unity5/Assets/_Tests/EmptySequences.unity
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: edc73fd9a50533b4e85686c195446773
|
||||
timeCreated: 1533629002
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -114,7 +114,7 @@ namespace DG.Tweening.Core
|
||||
if (_duplicateToDestroy) return;
|
||||
|
||||
if (DOTween.showUnityEditorReport) {
|
||||
string s = "REPORT > Max overall simultaneous active Tweeners/Sequences: " + DOTween.maxActiveTweenersReached + "/" + DOTween.maxActiveSequencesReached;
|
||||
string s = "Max overall simultaneous active Tweeners/Sequences: " + DOTween.maxActiveTweenersReached + "/" + DOTween.maxActiveSequencesReached;
|
||||
Debugger.LogReport(s);
|
||||
}
|
||||
// DOTween.initialized = false;
|
||||
|
||||
@ -17,22 +17,24 @@ namespace DG.Tweening.Core
|
||||
// 0: errors only - 1: default - 2: verbose
|
||||
public static int logPriority;
|
||||
|
||||
const string _LogPrefix = "<color=#0099bc><b>DOTWEEN ► </b></color>";
|
||||
|
||||
public static void Log(object message)
|
||||
{
|
||||
Debug.Log("DOTWEEN :: " + message);
|
||||
Debug.Log(_LogPrefix + message);
|
||||
}
|
||||
public static void LogWarning(object message)
|
||||
{
|
||||
Debug.LogWarning("DOTWEEN :: " + message);
|
||||
Debug.LogWarning(_LogPrefix + message);
|
||||
}
|
||||
public static void LogError(object message)
|
||||
{
|
||||
Debug.LogError("DOTWEEN :: " + message);
|
||||
Debug.LogError(_LogPrefix + message);
|
||||
}
|
||||
|
||||
public static void LogReport(object message)
|
||||
{
|
||||
Debug.Log("<color=#00B500FF>DOTWEEN :: " + message + "</color>");
|
||||
Debug.Log(string.Format("<color=#00B500FF>{0} REPORT ► {1}</color>", _LogPrefix, message));
|
||||
}
|
||||
|
||||
public static void LogInvalidTween(Tween t)
|
||||
|
||||
@ -32,7 +32,7 @@ namespace DG.Tweening
|
||||
public class DOTween
|
||||
{
|
||||
/// <summary>DOTween's version</summary>
|
||||
public static readonly string Version = "1.2.055"; // Last version before modules: 1.1.755
|
||||
public static readonly string Version = "1.2.060"; // Last version before modules: 1.1.755
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// Options ////////////////////////////////////
|
||||
|
||||
@ -266,7 +266,14 @@ namespace DG.Tweening
|
||||
Tween t = (Tween)sequentiable;
|
||||
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)) return 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)
|
||||
TweenManager.Despawn(t, false);
|
||||
s._sequencedObjs.RemoveAt(i);
|
||||
--i; --len;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Fixes nested callbacks not being called correctly if main sequence has loops and nested ones don't
|
||||
if (multiCycleStep && t.tweenType == TweenType.Sequence) {
|
||||
@ -314,7 +321,14 @@ namespace DG.Tweening
|
||||
}
|
||||
//
|
||||
t.isBackwards = false;
|
||||
if (TweenManager.Goto(t, gotoPos, false, updateMode)) return 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)
|
||||
TweenManager.Despawn(t, false);
|
||||
s._sequencedObjs.RemoveAt(i);
|
||||
--i; --len;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Fixes nested callbacks not being called correctly if main sequence has loops and nested ones don't
|
||||
if (multiCycleStep && t.tweenType == TweenType.Sequence) {
|
||||
|
||||
@ -280,7 +280,9 @@ namespace DG.Tweening
|
||||
try {
|
||||
callback();
|
||||
} catch (Exception e) {
|
||||
Debugger.LogWarning("An error inside a tween callback was silently taken care of > " + e.Message + "\n\n" + e.StackTrace + "\n\n");
|
||||
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
|
||||
));
|
||||
return false; // Callback error
|
||||
}
|
||||
} else callback();
|
||||
@ -292,7 +294,9 @@ namespace DG.Tweening
|
||||
try {
|
||||
callback(param);
|
||||
} catch (Exception e) {
|
||||
Debugger.LogWarning("An error inside a tween callback was silently taken care of > " + e.Message);
|
||||
Debugger.LogWarning(string.Format(
|
||||
"An error inside a tween callback was silently taken care of ({0}) ► {1}", e.TargetSite, e.Message
|
||||
));
|
||||
return false; // Callback error
|
||||
}
|
||||
} else callback(param);
|
||||
|
||||
@ -4,6 +4,9 @@
|
||||
// License Copyright (c) Daniele Giardini.
|
||||
// This work is subject to the terms at http://dotween.demigiant.com/license.php
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
#if COMPATIBLE
|
||||
using DOVector3 = DG.Tweening.Core.Surrogates.Vector3Wrapper;
|
||||
using DOQuaternion = DG.Tweening.Core.Surrogates.QuaternionWrapper;
|
||||
@ -130,7 +133,10 @@ namespace DG.Tweening
|
||||
if (DOTween.useSafeMode) {
|
||||
try {
|
||||
t.startValue = t.tweenPlugin.ConvertToStartValue(t, t.getter());
|
||||
} catch {
|
||||
} catch (Exception e) {
|
||||
Debugger.LogWarning(string.Format(
|
||||
"Tween startup failed (NULL target/property - {0}): the tween will now be killed ► {1}", e.TargetSite, e.Message
|
||||
));
|
||||
return false; // Target/field doesn't exist: kill tween
|
||||
}
|
||||
} else t.startValue = t.tweenPlugin.ConvertToStartValue(t, t.getter());
|
||||
|
||||
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