It happens a lot in Unity 2017.2 and 2017.3.0p1.
I wasted weeks trying to get rid of this random crashes, both in editor and Android builds.
Basically, if you quickly click over UI elements that activate/deactivate others, or when you quit the game, you get an hard crash, both in editor and Android builds, with vague (or zero) information logged.
A typical stack trace shows this (Android):
Thread 0 (crashed)
0 . <unknown>
1 Mono Runtime at (wrapper managed-to-native) UnityEngine.GameObject.SetActive (bool) <IL 0x0002e, 0xffffffff>
2 Mono Runtime at Angrymals.Game.Menu.AuthenticationPanel.ShowLoginForm (Angrymals.Game.Menu.LoginFormType) [0x00057] in H:\Angrymals Development\Game Client\AngrymalsGame\Assets\Angrymals\Scripts\Menu\AuthenticationPanel.cs:69
or this (Editor):
========== OUTPUTING STACK TRACE ==================
0x00000001403BECA6 (Unity) GameObject::IsActive
0x00000001417EB0D5 (Unity) UI::CanvasManager::AddDirtyRenderer
0x00000001417F0D0C (Unity) UI::CanvasRenderer::AwakeFromLoad
0x0000000140A9867A (Unity) AwakeFromLoadQueue::InvokeAwakeFromLoad
0x0000000140A9A391 (Unity) AwakeFromLoadQueue::AwakeFromLoad
0x00000001403C02DF (Unity) GameObject::ActivateAwakeRecursively
0x00000001403C06B6 (Unity) GameObject::Activate
0x0000000035817165 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.GameObject:SetActive (bool)
0x000000004BC2D157 (Mono JIT Code) [H:\Angrymals Development\Game Client\AngrymalsGame\Assets\Angrymals\Scripts\Battlefield\GUI\Controls\AppearingToggle.cs:38] Angrymals.Game.Menu.AppearingToggle:Toggle ()
This kind of bug has been reported here, one year and half ago.
I also noticed an identical behavior related to activating an object with an Animator component.
(another example with GameObject.SetActive and Animator can be found here)
Other reports:
Logs also often point out some Access violation reading location problem.
Anyone else facing this issue? Any idea on how to solve it, or at least to get the Unity team to work on it?
It’s basically impossible to ship a game that randomly crashes when user clicks on the UI.