1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-21 17:56:08 +08:00

Fixed IndexOutOfRangeException when creating many Tweeners and Sequences

This commit is contained in:
Daniele Giardini 2015-05-13 17:02:23 +02:00
parent d790014955
commit d70e0055d4
55 changed files with 61 additions and 38 deletions

View File

@ -201,6 +201,7 @@
Stores a GUIStyle palette, which can be passed to default DeGUI layouts when calling <code>DeGUI.BeginGUI</code>, Stores a GUIStyle palette, which can be passed to default DeGUI layouts when calling <code>DeGUI.BeginGUI</code>,
and changed at any time by calling <code>DeGUI.ChangePalette</code>. and changed at any time by calling <code>DeGUI.ChangePalette</code>.
You can inherit from this class to create custom GUIStyle palettes with more options. You can inherit from this class to create custom GUIStyle palettes with more options.
Each of the sub-options require a public Init method to initialize the styles, which will be called via Reflection.
</summary> </summary>
</member> </member>
<member name="M:DG.DemiEditor.DeStylePalette.Init"> <member name="M:DG.DemiEditor.DeStylePalette.Init">
@ -214,31 +215,6 @@
Extend any custom subpalettes from this, so they will be initialized correctly Extend any custom subpalettes from this, so they will be initialized correctly
</summary> </summary>
</member> </member>
<member name="M:DG.DemiEditor.Box.Init">
<summary>
Needs to be overridden in order to initialize new styles added from inherited classes
</summary>
</member>
<member name="M:DG.DemiEditor.Button.Init">
<summary>
Needs to be overridden in order to initialize new styles added from inherited classes
</summary>
</member>
<member name="M:DG.DemiEditor.Label.Init">
<summary>
Needs to be overridden in order to initialize new styles added from inherited classes
</summary>
</member>
<member name="M:DG.DemiEditor.Toolbar.Init">
<summary>
Needs to be overridden in order to initialize new styles added from inherited classes
</summary>
</member>
<member name="M:DG.DemiEditor.Misc.Init">
<summary>
Needs to be overridden in order to initialize new styles added from inherited classes
</summary>
</member>
<member name="T:DG.DemiEditor.DeGUILayout"> <member name="T:DG.DemiEditor.DeGUILayout">
<summary> <summary>
GUILayout methods GUILayout methods

View File

@ -5,16 +5,12 @@ using System.Collections;
public class Temp : BrainBase public class Temp : BrainBase
{ {
public Transform target, follow; public Transform target;
void Start() void Start()
{ {
Tweener tween = target.DOMove(follow.position, 2f) for (int i = 0; i < 300; ++i) {
.SetEase(Ease.OutExpo); DOTween.Sequence().AppendInterval(3).Append(target.DOMoveX(1, 1));
}
tween.OnUpdate(() =>
{
tween.ChangeEndValue(follow.position, true);
});
} }
} }

View File

@ -0,0 +1,20 @@
using DG.Tweening;
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class Follow : BrainBase
{
public Transform target, follow;
void Start()
{
Tweener tween = target.DOMove(follow.position, 2f)
.SetEase(Ease.OutExpo);
tween.OnUpdate(() =>
{
tween.ChangeEndValue(follow.position, true);
});
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 755a43ab5dbf4494d841429b6cf1756a
timeCreated: 1431430013
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 443a600519bc2014abf8f88d52c39ae4
timeCreated: 1431429998
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -7,8 +7,17 @@ using System;
public class TempTests : BrainBase public class TempTests : BrainBase
{ {
void OnMouseDown() IEnumerator Start()
{ {
this.GetComponent<DOTweenAnimation>().DOPlay(); yield return new WaitForSeconds(0.8f);
Debug.Log(Time.realtimeSinceStartup + " Create tween");
DOTween.Sequence()
.SetId(123)
.PrependInterval(3)
.OnComplete(() => Debug.Log(Time.realtimeSinceStartup + " First callback!"));
DOTween.Kill(123, true);
} }
} }

View File

@ -284,7 +284,8 @@ namespace DG.Tweening.Core
{ {
if (tweenersCapacity < sequencesCapacity) tweenersCapacity = sequencesCapacity; if (tweenersCapacity < sequencesCapacity) tweenersCapacity = sequencesCapacity;
maxActive = tweenersCapacity; // maxActive = tweenersCapacity;
maxActive = tweenersCapacity + sequencesCapacity;
maxTweeners = tweenersCapacity; maxTweeners = tweenersCapacity;
maxSequences = sequencesCapacity; maxSequences = sequencesCapacity;
Array.Resize(ref _activeTweens, maxActive); Array.Resize(ref _activeTweens, maxActive);
@ -834,7 +835,8 @@ namespace DG.Tweening.Core
Array.Resize(ref _pooledTweeners, maxTweeners); Array.Resize(ref _pooledTweeners, maxTweeners);
break; break;
} }
maxActive = Mathf.Max(maxTweeners, maxSequences); // maxActive = Mathf.Max(maxTweeners, maxSequences);
maxActive = maxTweeners + maxSequences;
Array.Resize(ref _activeTweens, maxActive); Array.Resize(ref _activeTweens, maxActive);
if (killAdd > 0) _KillList.Capacity += killAdd; if (killAdd > 0) _KillList.Capacity += killAdd;
} }

View File

@ -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.0.705"; public static readonly string Version = "1.0.710";
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Options //////////////////////////////////// // Options ////////////////////////////////////

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.