Demigiant / dotween

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

Is there any side effect if increase sequence cappacity ? #618

Closed jeffkenz89 closed 1 year ago

jeffkenz89 commented 1 year ago

Hello , i Wanna ask if there is side effect when increase sequence capcity from 10 to 1000 ?or is there any maximum recommended cappacity for sequence?

Demigiant commented 1 year ago

Ahoy, Sequence/Tweener capacity will be automatically increased when needed, but increasing it manually is better to prevent the possible (though improbable) hiccup of that happening. It's best to set it to a little more than what you need overall (you can see how many Tweeners/Sequences your game ran while in the editor, in the log when exiting play mode), but it's a micro-optimization. In practice, every frame DOTween loops over its internal Sequence/Tweener array to see which ones are filled and playing and updates them, so keeping the list not bigger than needed is best. At the same time, this loop is very optimized (so even if the capacity is 1000 it won't necessarily loop over 1000 indexes but behave more intelligently) so it's not a biggie (and 1000 is not a particularly big number for it).