Open Froghut opened 4 years ago
Catched same bug. Looks like some static members inside DoTween library have to be set null on ApplicationQuit. I had same issues with my libs usually in singletons objects. (and any other static members)
Looks like DoTween does not create [DOTween] gameobject with DoTween Component after Reload.
Are you using the Pro? Because if not I fixed that, and if yes let me know because I'm pushing a new update to the store soon.
Yes, I am using the Pro. Have updated to todays new version (1.0.244) and everything works correctly now. Thanx!
Sorry to revive an old issue, but I'm using DOTween Pro 1.0.335 and still seeing this exact behavior (and have been for a long time). It seems like there are scenarios where this still breaks with the enter play mode settings, though I can't seem to figure out why/how. All I've been able to find is that [DOTween]
gets added to the active scene rather than DontDestroyOnLoad
when it breaks and the tweens just start piling up. Force recompiling the scripts in the project clears it up every time, but it starts up again after entering play mode once or twice.
This seems to be the same issue I'm experiencing on 2022.3.X.
Running in Mac OS 13.4.
DOTween version 1.2.740 DOTweenProVVersion 1.0.370
The Dotween.Instances is bound but it's probably a stale instance. [dotween] does not show up in the hierarchy.
With Play Mode options (No Domain Reload and no Scene Reload)
Not sure what is going on but it happens at a hug frequency (25%) of the time.
I try to trap the case as a work around and manually force an init but it doesn't seem to fix the issue.
Any ideas? We have to keep on play-stop-play until it works. It really hurts my workflow as my loads are quite long already.
Do tween is Heavily integrated so it will be had to refactor it out. but the issue is severely impacting our ability to work.
I'm on the lastedt versio of pro.
Thanks!!!
Has Anyone been able to work around it?
Ahoy,
Sorry if I'm slow but it's big vacation time this week. I've been trying to test this out today on Unity 2022.3.5 but I can't replicate the issue. One thing that comes to mind is that it might be related to tweens being created inside OnDestroy methods of GameObjects (I can't replicate it even like that, but it's the only thing that comes to my mind). Can you tell me if you have something like that happening? Also, it would really help me if you could somehow replicate this in a small project so I can check it out.
Hey Daniele,
Thanks for the quick reply and sorry to both you on your vacation.
I will check any tweens invoked OnDestroy and onDisable as well. I don't believe I do create tweens OnDestroy but, This is a good lead so I'll double check and get back to you on this.
I dont think I would have the cycles/resources to scale things down to a reproducible small project ATM. But I would be happy to record a video containing a debugger-step-through of the issue so you can at least see some of the state of the DOTweenComponent and DoTween classes. I'd be happy to share this out once I have it. The project is quite big (two years of work) and there is quite a lot of complexity so creating an isolate project might be hard. Let me know if you think this would be useful.
I am happy to try to dig into things more if you feel I can put break points in certain places, or you want me to sniff specific parts of the code.
Could it be that I am getting an exceptions from my own code during Application Quitting (exiting playmate) that could inhibit DoTween from shutting down correctly?
This Is a non-imperial observation but replication of the issue seems random and it appears that some days the issue manifests at higher rates than other other days.
Have a great vacation and Best Regards,
W
I completely understand (and thanks for the vacation wishes ^_^). A video would help a lot, yes! And in the video, when an error is reported, select the log and show it to me full, then select the DOTween gameObject and let me see its Inspector which has extra details.
Exceptions from your own code could inhibit DOTween from shutting down correctly if they break Unity's execution, and the fact that it happens randomly could be related to Unity's random execution order (afaik the order is regenerated every time you change some code or close and reopen Unity—not sure about this last one), where maybe sometimes DOTween shuts down before those errors happen and other times it shuts down after and is hindered by them.
Cheers! D
Okay awesome. that is great insight about exceptions during shut down. So thanks for this.
Every once in a while I had an exception on shutdown. i just fixed this on my end and it seems to have squashed the issue with DOTween. I didn't think to correlate the exception with dotween initializing issues. (Some times I would shut down, and then walk a way for the day and the DoTween error would manifest the next morning).
So I'm leaning on believing that expedition on shut down may be causing the issue of DOtween not getting deinitialized properly. I haven't 100% attributed the cause to this it but it seems quite likely.
The frequency I observed the issue seemed to align with the frequency I had an exception on shutdown. Further more, I was getting an expedition via the playModeStateChanged callback in my code. so I wonder if this would trigger it.
I'll report back soon with more info.
Did you still want me to replicate the issue and send you the logs/video?
I'm still having the same issue, though I'm not seeing any exceptions on enter/exit play mode. However, testing for that I noticed something I hadn't seen before. The follow error logs randomly when exiting play mode, and when it does, the issue described above happens 100% of the time when entering play mode next. There is no stack trace, any ideas what could be causing this?
Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)
The following scene GameObjects were found:
[DOTween]
I'm still having the same issue, though I'm not seeing any exceptions on enter/exit play mode. However, testing for that I noticed something I hadn't seen before. The follow error logs randomly when exiting play mode, and when it does, the issue described above happens 100% of the time when entering play mode next. There is no stack trace, any ideas what could be causing this?
Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?) The following scene GameObjects were found: [DOTween]
Update: After digging into this more, I discovered that there was a tween being started in an OnDisable function, which then obviously gets called when exiting play mode. Changing this to only happen when not quitting the application seems to have resolved the issue (assuming the randomness of it isn't causing a false-positive here).
Hi James, thanks for posting more details about what you are observing.
I was also getting an occasion 'Some Objects were not cleaned up when closing the scene'.
I do not believe I am doing any tweens from OnDestroy/OnDisable but some of my own code was trigging the Some-Objects-were-not-cleaned expcetion.
After fixing this and another unrelated case, I have not observed issue #385 in two days (entering play mode around 20-30 times).
Defiantly a similarity between what we are both observing But also seconding with your point that if we can't attribute this to the cause of 385 then we cannot confirm this to be the cause/workaround.
[Update] So I am still seeing #385 after fixing a bunch of "Som Objects were not cleaned issues" that were caused from other issues with my code (and not DoTween).
Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)
The following scene GameObjects were found:
[DOTween]
After getting this issue, I pressed play and observedI #385.
My thoughts are that the issue is cased exactly how Daniele mentioned (with creating tweens from Disable/Destroy) and what GoldFire observed.
Ahoy! I actually managed to reproduce it few days ago, and yes, the cause is tweens being created within OnDestroy/OnDisable when Unity shuts down. It was hard to reproduce because it happens randomly (due to Unity's random execution order), and because for some reason Unity destroys DOTween when quitting but when a new tween is created it doesn't return to me correctly that it's quitting, so I recreate the DOTween gameObject.
I wanted to make some tests to fix it but when updating Visual Studio my computer went into a BSOD loop which turned out to be an SSD failure, which then proceeded to kill my system disk and format my data disk (it was a frankly astounding cascade of bad luck, yayyy) so now I'm stumped until the beginning of September when I'll be back home. I apologize a lot about this and I'm going to try to find a remedy sooner, but in the meantime I recommend doing what @goldfire suggested, and creating tweens inside OnDestroy/OnDisable only if Unity is not quitting. Sorry again!
Awesome great news!
I was just thinking last night something I was going to try today:
Could you try to manipulate the script execution order to force consistent replication of the issue?
It might help in verifying the fix.
In any case thanks for a help getting to the bottom of the issue!
You guys all rock!
Thank you! I tried manipulating the script execution order while doing those tests but somehow that didn't help, and it seemed (not 100'% sure tho) that Unity was respecting the execution order when calling the core methods but ignoring it when shutting down and destroying objects.
Hi, this issue has become pretty annoying lately - can you recommend a work around?
I can't speak much to the repro steps for this issue other than to say that our project exhibits some similarities (Reload Domain is disabled, and there are likely tweens starting in OnDisable / OnDestroy during an exit from play mode). If time allows I'll try to dig into this intermittently as it occurs.
However, in the interim, sticking an editor-only call to this function in an Update loop has effectively circumvented this issue for us:
[Conditional("UNITY_EDITOR")]
void EnsureDoTweenInstanceIsValid() {
if(!Application.isPlaying) {
return;
}
// Domain Reload problem: in cases where DOTween no longer appears to be executing, it's seems like the DOTween instance is valid in the
// managed scope, but destroyed on the native side. The check against the scene here is one way to check for this situation.
if(DOTween.instance != null && !DOTween.instance.gameObject.scene.IsValid()) {
Debug.LogError("DOTween instance appears to be missing at play time. This is probably the result of Domain Reloading being disabled; creating...", this);
// == Copied from DOTween internals ==
var target = new GameObject("[DOTween]");
DontDestroyOnLoad(target);
DOTween.instance = target.AddComponent<DOTweenComponent>();
}
}
Thanks -- this seems to prevent the issue -- appreciate it!
I can't speak much to the repro steps for this issue other than to say that our project exhibits some similarities (Reload Domain is disabled, and there are likely tweens starting in OnDisable / OnDestroy during an exit from play mode). If time allows I'll try to dig into this intermittently as it occurs.
However, in the interim, sticking an editor-only call to this function in an Update loop has effectively circumvented this issue for us:
[Conditional("UNITY_EDITOR")] void EnsureDoTweenInstanceIsValid() { if(!Application.isPlaying) { return; } // Domain Reload problem: in cases where DOTween no longer appears to be executing, it's seems like the DOTween instance is valid in the // managed scope, but destroyed on the native side. The check against the scene here is one way to check for this situation. if(DOTween.instance != null && !DOTween.instance.gameObject.scene.IsValid()) { Debug.LogError("DOTween instance appears to be missing at play time. This is probably the result of Domain Reloading being disabled; creating...", this); // == Copied from DOTween internals == var target = new GameObject("[DOTween]"); DontDestroyOnLoad(target); DOTween.instance = target.AddComponent<DOTweenComponent>(); } }
Thank you! This fixed it for us, too!
Hi, we continue to run into this problem even with the above fix. The above fix seems to break our tweens that are triggered in Awake/Start etc. Is there an official fix?
Hi, we're also still dealing with this issue. If domain reloading is disabled, and we invoke tweens when exiting play mode, subsequent sessions often result in some tweens breaking. The script that @coty-crg provided catches the fact that DOTween.instance is null and spawns a new one, but by the time it does that, a tween is already broken. @Demigiant are there any plans to fix this issue?
We are still continuing to have issues with this too. We purchased the pro version of DOTween but still the problem persists. We have to manually 'Realod Domain' to fix each time it shows up.
Same issues happen on my project
Using the latest DOTween asset store version and Unity 2019.3.5f (also happens with 6f and 7f) and with disabled "Reload Domain" and "Reload Scene" options (under "Enter Play Mode Options (Experimental)) it sometimes (randomly) happens that DOTween does not "execute" any tweens. They will get started, but will never actually "run". Also the "[DOTween]" Gameobject that gets automatically created will not get moved to the "DestroyOnLoad" Scene but will stay in the normal active Scene - and will also show the running tweens just piling up. This will happen sometimes 4 times in a row, other times it will not happen for ~30 times. Our project is rather large, I will try to reproduce this in a new empty test project and will add the results as soon as I have them.