Demigiant / dotween

A Unity C# animation engine. HOTween v2
http://dotween.demigiant.com
Other
2.29k stars 344 forks source link

DOComplete -> TweenManager.FilteredOperation: IndexOutOfRangeException (Possibly related to SetTweensCapacity?) #672

Open PortgateStudios opened 5 months ago

PortgateStudios commented 5 months ago

Hi guys!

I get relatively regular crash reports of IndexOutOfRangeException from TweenManager's FilteredOperation, however I couldn't reproduce it.

I updated DOTween to 1.2.745 but it still happens.

Here's the stacktrace:

DG.Tweening.Core.TweenManager.FilteredOperation
// Based on DOTween source code here should be a DOTween.Complete call but I guess IL2CPP skips it somehow.
DG.Tweening.ShortcutExtensions.DOComplete
// My Code, see below

From the limited reports (Windows, and Linux, both IL2CPP), all I know is that this happens on freshly loaded scenes.

The my side of the stacktrace should look like something like this, but sadly IL2CPP butchered it, so I cannot be sure:

  1. In a manager behaviour's Start I call some simple things, and also: DOTween.SetTweensCapacity(500, 312);
  2. I dispatch an event to my UserInterface.
  3. UserInterface wants to fade out a screen-covering blank image, calling DOFade() on its CanvasGroup... BUT before that: I call DOComplete() on it, because there are cases when there is an ongoing tween on it, and I don't want any interference.

I assume the problem isn't related to calling DOComplete() while there isn't any tween on the target, right? I mean this was my assumption, because I use it all the time, and this error only happens here, and only just on some devices.

Could it be related to Tween capacity changing? Okay, reading the comments on this method now really makes me think that having activate tweens is what causes this issue. In some Start() methods maybe I tween something and their Start()s are called earlier. Or maybe there are still tweens running due to the previous scene (through DontDestroyOnLoad).

Thanks in advance for all the help, let me know if I could provide more information. :)