dotween
dotween copied to clipboard
DOTween reinitializes itself after being destroyed.
When exiting Play Mode, DOTween destroys itself in OnDestroy, as expected:
DOTWEEN ► REPORT ► Max overall simultaneous active Tweeners/Sequences: 4/7
UnityEngine.Debug:Log(Object)
DG.Tweening.Core.Debugger:LogReport(Object) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/Debugger.cs:73)
DG.Tweening.Core.DOTweenComponent:OnDestroy() (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/DOTweenComponent.cs:132)
But if DOTween API is called in the same frame (in another GameObject's OnDestroy), DOTween outputs a message about initialization:
DOTWEEN ► DOTween initialization (useSafeMode: True, recycling: OFF, logBehaviour: Verbose)
UnityEngine.Debug:Log(Object)
DG.Tweening.Core.Debugger:Log(Object) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/Debugger.cs:32)
DG.Tweening.DOTween:Init(DOTweenSettings, Nullable`1, Nullable`1, Nullable`1) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/DOTween.cs:233)
DG.Tweening.DOTween:AutoInit() (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/DOTween.cs:194)
DG.Tweening.DOTween:InitCheck() (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/DOTween.cs:1075)
DG.Tweening.DOTween:ApplyTo(DOGetter`1, DOSetter`1, Single, Single, ABSTweenPlugin`3) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/DOTween.cs:1083)
DG.Tweening.DOTween:To(DOGetter`1, DOSetter`1, Single, Single) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/DOTween.cs:352)
DG.Tweening.DOTweenModuleUI:DOFade(CanvasGroup, Single, Single) (at Assets/ThirdParty/DOTween/Modules/DOTweenModuleUI.cs:31)
BalloonMessage:Close(Single) (at Assets/Scripts/UI/Text/BalloonMessage.cs:181)
BalloonMessage:OnDisable() (at Assets/Scripts/UI/Text/BalloonMessage.cs:44)
This message is followed by errors:
DOTWEEN ► Error in RemoveActiveTween (totActiveDefaultTweens < 0). It's been taken care of so no problems, but Daniele (DOTween's author) is trying to pinpoint it (it's very rare and he can't reproduce it) so it would be awesome if you could reproduce this log in a sample project and send it to him. Or even just write him the complete log that was generated by this message. Fixing this would make DOTween slightly faster. Thanks.
UnityEngine.Debug:LogWarning(Object)
DG.Tweening.Core.Debugger:LogWarning(Object, Tween) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/Debugger.cs:40)
DG.Tweening.Core.Debugger:LogRemoveActiveTweenError(String, Tween) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/Debugger.cs:119)
DG.Tweening.Core.TweenManager:RemoveActiveTween(Tween) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:1172)
DG.Tweening.Core.TweenManager:Despawn(Tween, Boolean) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:236)
DG.Tweening.TweenExtensions:Kill(Tween, Boolean) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/TweenExtensions.cs:145)
BarDeltaAnimation:OnDestroy() (at Assets/Scripts/UI/Effects/BarDeltaAnimation.cs:35)
Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)
The following scene GameObjects were found:
[DOTween]
Possible fix: ignore all calls to DOTween API after it has been destroyed.
Ouch, good point. The problem is that I know some users destroy DOTween's gameObject on scene change but then want to tween again (the recommended way would be to just use DOTween.KillAll()
, but still), so I have to listen to API calls. I will ponder about this
Confirm. The reason is probably the same as in https://github.com/Demigiant/dotween/issues/501
Any word on fixing or what to look for in our code?
@Demigiant –thanks for making such an awesome library! I just want to understand the problem a bit more.
So if I generally have each MonoBehaviour handling its own DotTween cleanup generally, i.e. calling _myFunTween.Kill()
, there's the potential that when quitting the app, one of those calls to the API will re-invoke DotTween library?
If that's the case, is it better to call DOTween.KillAll()
a single time at a higher level?
Since it's failing on quit, it's not generally a huge issue, but it is confusing for beta-testers on TestFlight who get a strange message when they relaunch the app after quitting, saying that the app had a sudden failure and that they should contact the dev. I get a lot of confused reports :)
Thanks for any tips!
Is there an update on this? It's not that big of a deal for us since it only happens when the application quits, but we're trying to keep our logs error-free.
I also ran into the same problem, I fixed it using :
private void OnApplicationQuit() { DOTween.KillAll(); }
in an empty gameobject.
@Demigiant I'm running into the same problem. @CoKeFish's solution doesn't work for me. I think the problem could be that I'm using DOTween in OnDeselected of a component that implements IDeselectHandler. Does that seem like that would activate this error, and how should I handle it?
I also notice that after it happens, when I run the scene again, the gameobject [DOTween] doesn't show up in DontDestroyOnLoad or in the hierarchy at all. When this happens, none of the DOTween calls I make happen reliably - sometimes they do happen, but sometimes not. The behavior is kinda confusing to me and hard to explain. Let me know if you need more info!
I have the same issue. Not a dealbreaker, but would definitely be nicer without the error on quit. They give me the creeps. Was thinking about dressing up as a Debug.LogError message for halloween.
@Demigiant I'm running into the same problem. @CoKeFish's solution doesn't work for me. I think the problem could be that I'm using DOTween in OnDeselected of a component that implements IDeselectHandler. Does that seem like that would activate this error, and how should I handle it?
I also notice that after it happens, when I run the scene again, the gameobject [DOTween] doesn't show up in DontDestroyOnLoad or in the hierarchy at all. When this happens, none of the DOTween calls I make happen reliably - sometimes they do happen, but sometimes not. The behavior is kinda confusing to me and hard to explain. Let me know if you need more info!
Did you find a good solution? Even in my case, IDeselectHandler have a problem.