See the attached player log. In there you see that the analytics events at startup get send successfully. When I close the game (without doing anything else) the game actually crashes.
It is in the creation of a webrequest by the analytics system.
Could you provide a little more information on what you are testing on?
It looks like you are testing on a touch enabled windows machine?
It seems to be crashing maybe on attempt to flush the events when you close the game.
I will try to reproduce using the versions you mentioned and post back here.
It indeed crashes when flushing the events I think. I avoided the issue by disabling analytics at shutdown, but because of that I’ll never get a gameEnded event. But at least it does not crash.
The device I’m testing on is a very classic desktop with windows 10, no touch enabled. I am using a bluetooth mouse.
Hi @grrava thanks, I was indeed able to reproduce the problem. I will report the problem to the team. Not sure if trying another version of the editor is an option at this point?
Hi. I confirm we are observing this crash too, with Unity 2022.3.14f1 LTS, for Windows builds. Haven’t tried yet to see if it happens on other platforms. It did not seem to occur on 2021.3.22f1 LTS.
Cheers,
Charles
Can you please help on finding at least a workaround? We’re on latest Analytics version and every single exit of the game from all players and QA team provokes this crash, flooding JIRA with thousands of undesired, unfixable (it seems) entries.
Ideally, I’d want to disable completely Analytics right before the game exits, to avoid sending web requests upon exit, as it seems like it’s the cause of the issue?
Note that this stacktrace is from a debug Mono build (for faster build times), but it happens in the same way with similar stacktrace in IL2CPP (used for release builds).
This at least solves many crashes upon “proper game exit”.
Note: The migration mentioned in the link above is mandatory, otherwise it’ll use the old flow and StopDataCollection() will do nothing!
However, it still crashed if ALT+F4 was pressed, because not using the Exit button. By adding StopDataCollection() to OnApplicationQuit(), it also solves the crash upon hard exit.
So, it’s definitely related to Analytics still trying to perform stuff OnApplicationQuit(). This might be something Unity will want to solve to avoid everyone having to perform these changes. I didn’t see the documentation mentioning calling StopDataCollection() was mandatory before exiting the game, so I don’t think this is intended?
Thank you!
@grrava and @manuelgoellnitz You may want to try this out in case it fixes it for you for now
Indeed, the crashes stopped after putting StopDataCollection() to OnApplicationQuit(). I put a FlushEvents() before stopping the data collection to still get events that have not been sent previously.
Hey folks, 5.0.2 has been released targeting this bug. Can you try updating and letting us know if this resolves the issue? Initial testing looked good in our tests but would like to have your feedback.
Hey Seb, do I interpret the release notes right that this is only targeting 2023.x? Analytics no longer throws a fatal exception on shutdown for builds made with 2023 editor versions
I ask because I got the crashes with builds made on 2022.3.14f1.