mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-20 09:16:02 +08:00
Fixed IndexOutOfRangeException when reorganizing tweens and capacity increased the first time without ever having being manually set
This commit is contained in:
parent
08b0f5a677
commit
2a8e7cc55c
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,41 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using DG.Tweening;
|
||||
|
||||
public class IndexOutOfRangeReproduced : BrainBase
|
||||
{
|
||||
public Transform target;
|
||||
|
||||
int totDelayedCalls;
|
||||
int totCreatedTweens;
|
||||
|
||||
void Start()
|
||||
{
|
||||
// DOTween.SetTweensCapacity(200, 50);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Space)) {
|
||||
for (int j = 0; j < 20; j++) {
|
||||
totDelayedCalls++;
|
||||
DOVirtual.DelayedCall(0.1f * j, MakeTween);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MakeTween()
|
||||
{
|
||||
for (int i = 0; i < 50; i++) {
|
||||
totCreatedTweens++;
|
||||
Tween t = target.DOMove(new Vector3(1, 1), 0.5f);
|
||||
if (i == 49) t.OnComplete(()=> DOTween.KillAll());
|
||||
}
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
GUILayout.Label("Tweens: " + totCreatedTweens);
|
||||
GUILayout.Label("Delayed Calls: " + totDelayedCalls);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c354015de77731943837b7edaeb53a5b
|
||||
timeCreated: 1459677183
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95e2696918659fc4f941a35a6f007551
|
||||
timeCreated: 1459677176
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -10,11 +10,17 @@ using UnityEngine.UI;
|
||||
|
||||
public class TempTests : BrainBase
|
||||
{
|
||||
public Color32 color;
|
||||
|
||||
void Start ()
|
||||
IEnumerator Start ()
|
||||
{
|
||||
DOTween.To(()=> color, x=> color = x, Color.red, 2)
|
||||
.OnUpdate(()=> Debug.Log(color));
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
|
||||
Debug.Log(Time.realtimeSinceStartup);
|
||||
DOVirtual.DelayedCall(2, ()=> Debug.Log("Call > " + Time.realtimeSinceStartup))
|
||||
.OnStart(()=> Debug.Log("Start > " + Time.realtimeSinceStartup));
|
||||
|
||||
DOTween.Sequence()
|
||||
.OnStart(()=> Debug.Log("S Start > " + Time.realtimeSinceStartup))
|
||||
.AppendInterval(2)
|
||||
.OnComplete(()=> Debug.Log("S Complete > " + Time.realtimeSinceStartup));
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@ -1,2 +1,2 @@
|
||||
m_EditorVersion: 5.4.0b10
|
||||
m_EditorVersion: 5.3.2f1
|
||||
m_StandardAssetsVersion: 0
|
||||
|
||||
@ -17,7 +17,7 @@ namespace DG.Tweening.Core
|
||||
const int _DefaultMaxSequences = 50;
|
||||
const string _MaxTweensReached = "Max Tweens reached: capacity has automatically been increased from #0 to #1. Use DOTween.SetTweensCapacity to set it manually at startup";
|
||||
|
||||
internal static int maxActive = _DefaultMaxTweeners; // Always equal to maxTweeners
|
||||
internal static int maxActive = _DefaultMaxTweeners + _DefaultMaxSequences; // Always equal to maxTweeners + maxSequences
|
||||
internal static int maxTweeners = _DefaultMaxTweeners; // Always >= maxSequences
|
||||
internal static int maxSequences = _DefaultMaxSequences; // Always <= maxTweeners
|
||||
internal static bool hasActiveTweens, hasActiveDefaultTweens, hasActiveLateTweens, hasActiveFixedTweens;
|
||||
@ -29,11 +29,11 @@ namespace DG.Tweening.Core
|
||||
|
||||
// Tweens contained in Sequences are not inside the active lists
|
||||
// Arrays are organized (max once per update) so that existing elements are next to each other from 0 to (totActiveTweens - 1)
|
||||
internal static Tween[] _activeTweens = new Tween[_DefaultMaxTweeners]; // Internal just to allow DOTweenInspector to access it
|
||||
internal static Tween[] _activeTweens = new Tween[_DefaultMaxTweeners + _DefaultMaxSequences]; // Internal just to allow DOTweenInspector to access it
|
||||
static Tween[] _pooledTweeners = new Tween[_DefaultMaxTweeners];
|
||||
static readonly Stack<Tween> _PooledSequences = new Stack<Tween>();
|
||||
|
||||
static readonly List<Tween> _KillList = new List<Tween>(_DefaultMaxTweeners);
|
||||
static readonly List<Tween> _KillList = new List<Tween>(_DefaultMaxTweeners + _DefaultMaxSequences);
|
||||
static int _maxActiveLookupId = -1; // Highest full ID in _activeTweens
|
||||
static bool _requiresActiveReorganization; // True when _activeTweens need to be reorganized to fill empty spaces
|
||||
static int _reorganizeFromId = -1; // First null ID from which to reorganize
|
||||
|
||||
@ -32,7 +32,7 @@ namespace DG.Tweening
|
||||
public class DOTween
|
||||
{
|
||||
/// <summary>DOTween's version</summary>
|
||||
public static readonly string Version = "1.1.200";
|
||||
public static readonly string Version = "1.1.250";
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// Options ////////////////////////////////////
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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