mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-20 01:06:02 +08:00
[BUGFIX] Fixed nested tweens waiting one frame before being paused if a nested callback paused the main Sequence
This commit is contained in:
parent
bbd58bd37a
commit
6dc0ac15e5
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 25e007bdbcd3d924b992ace777b1927f
|
||||
timeCreated: 1560264001
|
||||
guid: 8630922b6f4916b4c90b527c0cfd9c7d
|
||||
timeCreated: 1563966356
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3022aac9cb773eb418831741c656efec
|
||||
timeCreated: 1560263984
|
||||
guid: 26a359b3d4079e649903bf38c0f59873
|
||||
timeCreated: 1563966346
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65bddc2573542404ca55aa12e6572a5f
|
||||
timeCreated: 1560263991
|
||||
guid: 8be39b2e94b1ea14aac552bd533203c3
|
||||
timeCreated: 1563966350
|
||||
licenseType: Pro
|
||||
PluginImporter:
|
||||
serializedVersion: 2
|
||||
|
||||
Binary file not shown.
@ -11,12 +11,19 @@ using UnityEngine.UI;
|
||||
|
||||
public class TempTests : BrainBase
|
||||
{
|
||||
public Text tf;
|
||||
public Transform target;
|
||||
|
||||
IEnumerator Start()
|
||||
{
|
||||
yield return new WaitForSeconds(0.8f);
|
||||
|
||||
tf.DOText(null, 1);
|
||||
Sequence s = DOTween.Sequence();
|
||||
// s.Append(target.DOMoveX(2, 1));
|
||||
s.AppendCallback(() => {
|
||||
Debug.Log("Gonna pause here");
|
||||
s.Pause();
|
||||
})
|
||||
.AppendCallback(() => Debug.Log("Will move Y"))
|
||||
.Append(target.DOMoveY(2, 1));
|
||||
}
|
||||
}
|
||||
@ -34,7 +34,7 @@ namespace DG.Tweening
|
||||
public class DOTween
|
||||
{
|
||||
/// <summary>DOTween's version</summary>
|
||||
public static readonly string Version = "1.2.256"; // Last version before modules: 1.1.755
|
||||
public static readonly string Version = "1.2.260"; // Last version before modules: 1.1.755
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// Options ////////////////////////////////////
|
||||
|
||||
@ -245,12 +245,14 @@ namespace DG.Tweening
|
||||
// Returns TRUE if the tween needs to be killed
|
||||
static bool ApplyInternalCycle(Sequence s, float fromPos, float toPos, UpdateMode updateMode, bool useInverse, bool prevPosIsInverse, bool multiCycleStep = false)
|
||||
{
|
||||
bool wasPlaying = s.isPlaying; // Used to interrupt for loops in case a callback pauses a running Sequence
|
||||
bool isBackwardsUpdate = toPos < fromPos;
|
||||
// Debug.Log(Time.frameCount + " " + s.id + " " + (multiCycleStep ? "<color=#FFEC03>Multicycle</color> > " : "Cycle > ") + s.position + "/" + s.duration + " - s.isBackwards: " + s.isBackwards + ", useInverse/prevInverse: " + useInverse + "/" + prevPosIsInverse + " - " + fromPos + " > " + toPos + " - UpdateMode: " + updateMode + ", isPlaying: " + s.isPlaying + ", completedLoops: " + s.completedLoops);
|
||||
if (isBackwardsUpdate) {
|
||||
int len = s._sequencedObjs.Count - 1;
|
||||
for (int i = len; i > -1; --i) {
|
||||
if (!s.active) return true; // Killed by some internal callback
|
||||
if (!s.isPlaying && wasPlaying) return false; // Paused by internal callback
|
||||
ABSSequentiable sequentiable = s._sequencedObjs[i];
|
||||
if (sequentiable.sequencedEndPosition < toPos || sequentiable.sequencedPosition > fromPos) continue;
|
||||
if (sequentiable.tweenType == TweenType.Callback) {
|
||||
@ -296,6 +298,7 @@ namespace DG.Tweening
|
||||
int len = s._sequencedObjs.Count;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if (!s.active) return true; // Killed by some internal callback
|
||||
if (!s.isPlaying && wasPlaying) return false; // Paused by internal callback
|
||||
ABSSequentiable sequentiable = s._sequencedObjs[i];
|
||||
// if (sequentiable.sequencedPosition > toPos || sequentiable.sequencedEndPosition < fromPos) continue;
|
||||
// Fix rare case with high FPS when a tween/callback might happen in same exact time as it's set
|
||||
|
||||
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