dotween icon indicating copy to clipboard operation
dotween copied to clipboard

IndexOutOfRangeException

Open nostel opened this issue 8 years ago • 7 comments

Hi, I often get this bug after running game in about 2-5 mins.

The DotTween setting is set to Default.

I use Tweener.Kill() a lot. If I don't use Tweener.Kill() I don't see this bug happen.

Error Log: This error always appear 1st IndexOutOfRangeException: Array index is out of range. DG.Tweening.Plugins.Core.PathCore.CatmullRomDecoder.FinalizePath (DG.Tweening.Plugins.Core.PathCore.Path p, UnityEngine.Vector3[] wps, Boolean isClosedPath) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/CatmullRomDecoder.cs:23) DG.Tweening.Plugins.Core.PathCore.Path.FinalizePath (Boolean isClosedPath, AxisConstraint lockPositionAxes, Vector3 currTargetVal) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/Path.cs:87) DG.Tweening.Plugins.PathPlugin.SetChangeValue (DG.Tweening.Core.TweenerCore3 t) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Plugins/PathPlugin.cs:89) DG.Tweening.Tweener.DoStartup[Vector3,Path,PathOptions] (DG.Tweening.Core.TweenerCore3 t) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Tweener.cs:141) DG.Tweening.Core.TweenerCore`3[UnityEngine.Vector3,DG.Tweening.Plugins.Core.PathCore.Path,DG.Tweening.Plugins.Options.PathOptions].Startup () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenerCore.cs:168) DG.Tweening.Core.TweenManager.Update (UpdateType updateType, Single deltaTime, Single independentTime) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:371) DG.Tweening.Core.DOTweenComponent.Update () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/DOTweenComponent.cs:51)

And these errors follow 1 NullReferenceException: Object reference not set to an instance of an object DG.Tweening.Plugins.PathPlugin.EvaluateAndApply (PathOptions options, DG.Tweening.Tween t, Boolean isRelative, DG.Tweening.Core.DOGetter1 getter, DG.Tweening.Core.DOSetter1 setter, Single elapsed, DG.Tweening.Plugins.Core.PathCore.Path startValue, DG.Tweening.Plugins.Core.PathCore.Path changeValue, Single duration, Boolean usingInversePosition, UpdateNotice updateNotice) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Plugins/PathPlugin.cs:111) DG.Tweening.Core.TweenerCore`3[UnityEngine.Vector3,DG.Tweening.Plugins.Core.PathCore.Path,DG.Tweening.Plugins.Options.PathOptions].ApplyTween (Single prevPosition, Int32 prevCompletedLoops, Int32 newCompletedSteps, Boolean useInversePosition, UpdateMode updateMode, UpdateNotice updateNotice) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenerCore.cs:184) DG.Tweening.Tween.DoGoto (DG.Tweening.Tween t, Single toPosition, Int32 toCompletedLoops, UpdateMode updateMode) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Tween.cs:238) DG.Tweening.Core.TweenManager.Update (UpdateType updateType, Single deltaTime, Single independentTime) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:417) DG.Tweening.Core.DOTweenComponent.Update () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/DOTweenComponent.cs:51)

2 IndexOutOfRangeException: Array index is out of range. DG.Tweening.Core.TweenManager.RemoveActiveTween (DG.Tweening.Tween t) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:862) DG.Tweening.Core.TweenManager.Despawn (DG.Tweening.Tween t, Boolean modifyActiveLists) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:199) DG.Tweening.Core.TweenManager.DespawnActiveTweens (System.Collections.Generic.List`1 tweens) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:850) DG.Tweening.Core.TweenManager.Update (UpdateType updateType, Single deltaTime, Single independentTime) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:429) DG.Tweening.Core.DOTweenComponent.Update () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/DOTweenComponent.cs:51)

3 IndexOutOfRangeException: Array index is out of range. (wrapper stelemref) object:stelemref (object,intptr,object) DG.Tweening.Core.TweenManager.ReorganizeActiveTweens () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:840) DG.Tweening.Core.TweenManager.Update (UpdateType updateType, Single deltaTime, Single independentTime) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:332) DG.Tweening.Core.DOTweenComponent.Update () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/DOTweenComponent.cs:51)

nostel avatar Feb 14 '17 04:02 nostel

Hi, I've just found the way to replicate it. Please add this script into an empty object and run Test function.

using UnityEngine;
using System.Collections;
using DG.Tweening;

public class Test : MonoBehaviour {
	
	[ContextMenu ("Test")]
	public void TestDotTween ()
	{
		Vector3[] wps = new Vector3[1];
		Vector3 wp0 = transform.localPosition;
		wps [0] = wp0;

		Tweener tween = transform.DOLocalPath (wps, 10, PathType.CatmullRom);
	}

}

nostel avatar Feb 14 '17 07:02 nostel

Seems like it's the case with how PathType.CatmullRom interpolates: it was either not meant for straight lines with 1 waypoint only, or the author missed this case. What worked for me was choosing PathType.Linear wherever I had only one waypoint and PathType.CatmullRom otherwise.

Ramori avatar Feb 14 '17 14:02 Ramori

Ah, Catmul-Rom is definitely not meant for one-point paths :P But I'll mark in my TODO to capture the error and throw a warning instead of an error.

Demigiant avatar Feb 14 '17 19:02 Demigiant

still exist for this bug

unitymatrix avatar Dec 29 '17 03:12 unitymatrix

I just encounter this bug too. And have some better resolutions? Or, just some other methods to replace kill?

JackWong0805 avatar Jan 14 '18 14:01 JackWong0805

emm, I just set the Capacity by mannual, and now I never encounter this bug.

JackWong0805 avatar Jan 29 '18 15:01 JackWong0805