Demigiant Forum

Unity Assets => DOTween & DOTween Pro => Topic started by: cynicalwanderer on October 30, 2015, 06:01:40 PM

Title: Error when exiting application
Post by: cynicalwanderer on October 30, 2015, 06:01:40 PM

I've recently added a bunch of extra tweens, pushing my active tween count over 256 (not sure if that's relevant or not, but it might be).  When I exit the app in the editor I'm now seeing this error that wasn't previously there:

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:833)
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:193)
DG.Tweening.TweenExtensions.Kill (DG.Tweening.Tween t, Boolean complete) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/TweenExtensions.cs:127)
DG.Tweening.DOTweenAnimation.OnDestroy () (at Assets/Demigiant/DOTweenPro/DOTweenAnimation.cs:84)

Screenshot of DOTween settings attached.

Title: Re: Error when exiting application
Post by: Daniele on October 30, 2015, 07:50:09 PM

That is an error that is present since a long time, but I never managed to replicate it so I can't solve it. Is there any way you can send me your project, so I have a sample that replicates it and can finally fix this thing? If not, I understand so don't worry.

In the meantime, you can fix it by raising the tween capacity manually. Just call this when your app starts:

Code: [Select]
DOTween.SetTweensCapacity(1000, 100);

Title: Re: Error when exiting application
Post by: cynicalwanderer on October 30, 2015, 10:25:51 PM
Hi, unfortunately no, my project is not in a state that can be shared at the moment.

In case this helps you with reproducing the bug - I have just reloaded Unity now to do some more work and the bug is not occurring at the moment, and I am currently unable to reproduce it - although it may come back, in which case I'll try the capacity bump you mentioned.  Earlier today when it first came up, I had just finished adding some 24 new tweens (pairs of tweens that scale up and then back down, using the OnComplete to pass control; also similar pairs for doing color) and had done a fair bit of component copy and paste-to-new to get those in place.  I'd been repeatedly hitting Play in the editor and then stopping to tweak further.  So possibly some sort of Unity or DOTween memory cache was building up and hit its upper limit, is all I can guess.  That was my first suspicion anyway when I checked the active tweens count and saw I had gone past 256 total.

Anyway hopefully something I said in all that clicks and helps you find it, but if not then it's good to know there's the capacity workaround if I see it again.
Title: Re: Error when exiting application
Post by: Daniele on October 31, 2015, 05:03:28 PM
Unfortunately that doesn't help. I know it's due to the tween's surpassing the max number and thus increasing the cache, but it usually works perfectly and there are only some very rare cases where it doesn't, which I never managed to replicate. That said, at least there's a fix, and I totally understand that you can't share your project: thanks for the detailed info :)