mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2026-03-26 22:49:03 +08:00
[BUGFIX] Fixed IndexOutOfRange exception happening when a Kill(complete) causes multiple tweens to be killed via nested OnComplete callbacks
This commit is contained in:
parent
c4366240e1
commit
6a0e92ce7e
@ -1778,6 +1778,17 @@
|
|||||||
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
|
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
|
||||||
<param name="mode">Rotation mode</param>
|
<param name="mode">Rotation mode</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendablePunchRotation(UnityEngine.Transform,UnityEngine.Vector3,System.Single,System.Int32,System.Single)">
|
||||||
|
<summary>Punches a Transform's localRotation BY the given value and then back to the starting one
|
||||||
|
as if it was connected to the starting rotation via an elastic. Does it in a way that allows other
|
||||||
|
DOBlendableRotate tweens to work together on the same target</summary>
|
||||||
|
<param name="punch">The punch strength (added to the Transform's current rotation)</param>
|
||||||
|
<param name="duration">The duration of the tween</param>
|
||||||
|
<param name="vibrato">Indicates how much will the punch vibrate</param>
|
||||||
|
<param name="elasticity">Represents how much (0 to 1) the vector will go beyond the starting rotation when bouncing backwards.
|
||||||
|
1 creates a full oscillation between the punch rotation and the opposite rotation,
|
||||||
|
while 0 oscillates only between the punch and the start rotation</param>
|
||||||
|
</member>
|
||||||
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableScaleBy(UnityEngine.Transform,UnityEngine.Vector3,System.Single)">
|
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableScaleBy(UnityEngine.Transform,UnityEngine.Vector3,System.Single)">
|
||||||
<summary>Tweens a Transform's localScale BY the given value (as if you chained a <code>SetRelative</code>),
|
<summary>Tweens a Transform's localScale BY the given value (as if you chained a <code>SetRelative</code>),
|
||||||
in a way that allows other DOBlendableScale tweens to work together on the same target,
|
in a way that allows other DOBlendableScale tweens to work together on the same target,
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -1778,6 +1778,17 @@
|
|||||||
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
|
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
|
||||||
<param name="mode">Rotation mode</param>
|
<param name="mode">Rotation mode</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendablePunchRotation(UnityEngine.Transform,UnityEngine.Vector3,System.Single,System.Int32,System.Single)">
|
||||||
|
<summary>Punches a Transform's localRotation BY the given value and then back to the starting one
|
||||||
|
as if it was connected to the starting rotation via an elastic. Does it in a way that allows other
|
||||||
|
DOBlendableRotate tweens to work together on the same target</summary>
|
||||||
|
<param name="punch">The punch strength (added to the Transform's current rotation)</param>
|
||||||
|
<param name="duration">The duration of the tween</param>
|
||||||
|
<param name="vibrato">Indicates how much will the punch vibrate</param>
|
||||||
|
<param name="elasticity">Represents how much (0 to 1) the vector will go beyond the starting rotation when bouncing backwards.
|
||||||
|
1 creates a full oscillation between the punch rotation and the opposite rotation,
|
||||||
|
while 0 oscillates only between the punch and the start rotation</param>
|
||||||
|
</member>
|
||||||
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableScaleBy(UnityEngine.Transform,UnityEngine.Vector3,System.Single)">
|
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableScaleBy(UnityEngine.Transform,UnityEngine.Vector3,System.Single)">
|
||||||
<summary>Tweens a Transform's localScale BY the given value (as if you chained a <code>SetRelative</code>),
|
<summary>Tweens a Transform's localScale BY the given value (as if you chained a <code>SetRelative</code>),
|
||||||
in a way that allows other DOBlendableScale tweens to work together on the same target,
|
in a way that allows other DOBlendableScale tweens to work together on the same target,
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -1778,6 +1778,17 @@
|
|||||||
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
|
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
|
||||||
<param name="mode">Rotation mode</param>
|
<param name="mode">Rotation mode</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendablePunchRotation(UnityEngine.Transform,UnityEngine.Vector3,System.Single,System.Int32,System.Single)">
|
||||||
|
<summary>Punches a Transform's localRotation BY the given value and then back to the starting one
|
||||||
|
as if it was connected to the starting rotation via an elastic. Does it in a way that allows other
|
||||||
|
DOBlendableRotate tweens to work together on the same target</summary>
|
||||||
|
<param name="punch">The punch strength (added to the Transform's current rotation)</param>
|
||||||
|
<param name="duration">The duration of the tween</param>
|
||||||
|
<param name="vibrato">Indicates how much will the punch vibrate</param>
|
||||||
|
<param name="elasticity">Represents how much (0 to 1) the vector will go beyond the starting rotation when bouncing backwards.
|
||||||
|
1 creates a full oscillation between the punch rotation and the opposite rotation,
|
||||||
|
while 0 oscillates only between the punch and the start rotation</param>
|
||||||
|
</member>
|
||||||
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableScaleBy(UnityEngine.Transform,UnityEngine.Vector3,System.Single)">
|
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableScaleBy(UnityEngine.Transform,UnityEngine.Vector3,System.Single)">
|
||||||
<summary>Tweens a Transform's localScale BY the given value (as if you chained a <code>SetRelative</code>),
|
<summary>Tweens a Transform's localScale BY the given value (as if you chained a <code>SetRelative</code>),
|
||||||
in a way that allows other DOBlendableScale tweens to work together on the same target,
|
in a way that allows other DOBlendableScale tweens to work together on the same target,
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -5,30 +5,31 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class IndexOutOfRangeOnKill02 : MonoBehaviour
|
public class IndexOutOfRangeOnKill02 : MonoBehaviour
|
||||||
{
|
{
|
||||||
// Can't replicate the error
|
public Transform target;
|
||||||
void Start()
|
public RectTransform targetUI;
|
||||||
|
|
||||||
|
void Update()
|
||||||
{
|
{
|
||||||
Debug.Log("Start() ► Disabling safe mode");
|
if(Input.GetKeyUp(KeyCode.L)) ReproTweenBug();
|
||||||
|
|
||||||
DOTween.Init(false, false);
|
|
||||||
|
|
||||||
Tween t = transform.DOMoveX(2, 2);
|
|
||||||
t.OnComplete(() => {
|
|
||||||
Debug.Log("OnComplete()");
|
|
||||||
TweenKiller();
|
|
||||||
Destroy(gameObject);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDestroy()
|
void ReproTweenBugKiller()
|
||||||
{
|
{
|
||||||
Debug.Log("OnDestroy()");
|
target.DOKill(true);
|
||||||
TweenKiller();
|
targetUI.DOKill(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TweenKiller()
|
void ReproTweenBug()
|
||||||
{
|
{
|
||||||
Debug.Log("TweenKiller()");
|
ReproTweenBugKiller();
|
||||||
transform.DOKill(true);
|
|
||||||
|
var rotation = 2 * 360;
|
||||||
|
var duration = rotation / 360f;
|
||||||
|
|
||||||
|
target.DORotate(new Vector3(0, 0, rotation), duration, RotateMode.FastBeyond360).SetEase(Ease.OutCubic)
|
||||||
|
.OnComplete(() => {
|
||||||
|
targetUI.DOAnchorPos(Vector2.zero, 0.4f).SetEase(Ease.InBack)
|
||||||
|
.OnComplete(() => targetUI.DOKill(true));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
@ -576,7 +576,12 @@ namespace DG.Tweening.Core
|
|||||||
// Special additional operations in case of despawn
|
// Special additional operations in case of despawn
|
||||||
if (hasDespawned) {
|
if (hasDespawned) {
|
||||||
int count = _KillList.Count - 1;
|
int count = _KillList.Count - 1;
|
||||||
for (int i = count; i > -1; --i) RemoveActiveTween(_KillList[i]);
|
for (int i = count; i > -1; --i) {
|
||||||
|
Tween t = _KillList[i];
|
||||||
|
// Ignore tweens with activeId -1, since they were already killed and removed
|
||||||
|
// by nested OnComplete callbacks
|
||||||
|
if (t.activeId != -1) RemoveActiveTween(t);
|
||||||
|
}
|
||||||
_KillList.Clear();
|
_KillList.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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.655";
|
public static readonly string Version = "1.1.660";
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// Options ////////////////////////////////////
|
// Options ////////////////////////////////////
|
||||||
|
|||||||
@ -1778,6 +1778,17 @@
|
|||||||
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
|
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
|
||||||
<param name="mode">Rotation mode</param>
|
<param name="mode">Rotation mode</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendablePunchRotation(UnityEngine.Transform,UnityEngine.Vector3,System.Single,System.Int32,System.Single)">
|
||||||
|
<summary>Punches a Transform's localRotation BY the given value and then back to the starting one
|
||||||
|
as if it was connected to the starting rotation via an elastic. Does it in a way that allows other
|
||||||
|
DOBlendableRotate tweens to work together on the same target</summary>
|
||||||
|
<param name="punch">The punch strength (added to the Transform's current rotation)</param>
|
||||||
|
<param name="duration">The duration of the tween</param>
|
||||||
|
<param name="vibrato">Indicates how much will the punch vibrate</param>
|
||||||
|
<param name="elasticity">Represents how much (0 to 1) the vector will go beyond the starting rotation when bouncing backwards.
|
||||||
|
1 creates a full oscillation between the punch rotation and the opposite rotation,
|
||||||
|
while 0 oscillates only between the punch and the start rotation</param>
|
||||||
|
</member>
|
||||||
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableScaleBy(UnityEngine.Transform,UnityEngine.Vector3,System.Single)">
|
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableScaleBy(UnityEngine.Transform,UnityEngine.Vector3,System.Single)">
|
||||||
<summary>Tweens a Transform's localScale BY the given value (as if you chained a <code>SetRelative</code>),
|
<summary>Tweens a Transform's localScale BY the given value (as if you chained a <code>SetRelative</code>),
|
||||||
in a way that allows other DOBlendableScale tweens to work together on the same target,
|
in a way that allows other DOBlendableScale tweens to work together on the same target,
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user