Demigiant / dotween

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

OnComplete problem (again of course) with singleton classes #668

Open kureysalp opened 6 months ago

kureysalp commented 6 months ago

I have a singleton class that has an Integer. I am incrementing this integer by one when I start a tween and in OnComplete of that tween decreasing it by one. Each tween is created by separate objects.

Issue is if these I create these tweens so fast, in some of the OnCompletes ignores the singleton call but calls other thins with no problem.

transform.DOMove(slot.transform.position, moveTimeToSlots.Value).OnComplete(() => { GameStateManager.Instance.MethodSingleton(); // Sometimes not calling MethodOne(); // always calling MethodTwo(); // always calling });

Edit: When I call the MethodSingleton for example in MethodOne, it works flawlessly. So it's 100% OnComplete and Singleton problem.