Game runs in Editor, crashes on startup after build. "Access Violation (0xc0000005)"
Hello, as the title states the game runs flawlessly in the Unity Editor, but crashes on startup when I try to run it after it's built. The problem only started after upgrading to Unity 5, there never was a problem when running the game when built with Unity 4. I'll post a bit of the error log and the stack trace as well.
One thing I noticed that's strange in the error log is that physical memory and paging file both only have 0 MB free. Here's a bit of error.log...
space_combat_apr_19_2015.exe caused an Access Violation (0xc0000005) in module space_combat_apr_19_2015.exe at 0023:014047c8.
Error occurred at 2015-04-19_182504. C:\Users\ASUS-tech\Dropbox\Coding\Unity\Test\Space Combat\Builds\Apr 19\space_combat_apr_19_2015.exe, run by ASUS-tech. 36% memory in use. 0 MB physical memory [0 MB free]. 0 MB paging file [0 MB free]. 0 MB user address space [3773 MB free]. Read from location 00000000 caused an access violation.
Context: EDI: 0x00000000 ESI: 0x04259650 EAX: 0x000f4000 EBX:
0x00000000 ECX: 0x04259650 EDX:
0x011d5ae0 EIP: 0x014047c8 EBP: 0x0106f0fc SegCs: 0x00000023 EFlags: 0x00010202 ESP: 0x0106f0f0 SegSs: 0x0000002b
And here is the stack trace from output_log.txt...
========== OUTPUTING STACK TRACE ==================
014047C8 (space_combat_apr_19_2015) Unity::Material::CreateMaterial 016DFAB1 (space_combat_apr_19_2015) RectT::Intersects 014E5EE5 (space_combat_apr_19_2015) AnimationCurveTpl::Sort 05161753 (Mono JIT Code) UnityEngine.UI.Graphic:get_defaultGraphicMaterial () 0516171B (Mono JIT Code) UnityEngine.UI.Graphic:get_defaultMaterial () 05161701 (Mono JIT Code) UnityEngine.UI.Graphic:get_material () 051613B7 (Mono JIT Code) UnityEngine.UI.MaskableGraphic:get_material () 0516122C (Mono JIT Code) UnityEngine.UI.Graphic:get_materialForRendering () 051611AF (Mono JIT Code) UnityEngine.UI.Graphic:UpdateMaterial () 0515E82D (Mono JIT Code) UnityEngine.UI.Graphic:Rebuild (UnityEngine.UI.CanvasUpdate) 0515E12C (Mono JIT Code) UnityEngine.UI.CanvasUpdateRegistry:PerformUpdate () 0515DE38 (Mono JIT Code) UnityEngine.Canvas:SendWillRenderCanvases () 051402FB (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr) 100F054D (mono) mono_set_defaults 1005D812 (mono) mono_runtime_invoke 01324FAE (space_combat_apr_19_2015) scripting_gchandle_get_target 013D1239 (space_combat_apr_19_2015) ScriptingArguments::AddString 013D12AE (space_combat_apr_19_2015) ScriptingArguments::AddString 013D12D5 (space_combat_apr_19_2015) ScriptingArguments::AddString 016E2620 (space_combat_apr_19_2015) RectT::Intersects 01396675 (space_combat_apr_19_2015) UserList::AddUser 0142DB81 (space_combat_apr_19_2015) PlayerMainWndProc 0142F800 (space_combat_apr_19_2015) PlayerWinMain 01764E98 (space_combat_apr_19_2015) RemapPPtrTransfer::TransferTypelessData 0179BECF (space_combat_apr_19_2015) RemapPPtrTransfer::TransferTypelessData 75EA7C04 (KERNEL32) BaseThreadInitThunk 7774AD1F (ntdll) RtlInitializeExceptionChain 7774ACEA (ntdll) RtlInitializeExceptionChain
========== END OF STACKTRACE ===========
Crash!
Any help is greatly appreciated, thanks!
I guess that my answer was removed, but I solved the problem.
The fix was to go into Edit > Project Settings > Graphics and under "Always Included Shaders" make sure that it contained UI/Default and UI/Default Font. $$anonymous$$ine didn't have either of those, but when I added them all the crashing problems went away and the built game ran flawlessly.
Aaron, you're a life saver!
Your solution works perfectly.
:)
Thanks! I'm just glad that posting my own fix was not in vain.
Answer by Aaron_T · Apr 21, 2015 at 02:29 PM
With help from wiliz and NCarter from the IRC chat, I was able to solve my own problem.
I learned that the game would crash when it tried to load a scene with any UI objects that had any component with a material set to none. Changing all the UI elements to have any actual material prevented crashes (but also screwed up the looks of the UI).
The fix was to go into Edit > Project Settings > Graphics and under "Always Included Shaders" make sure that it contained UI/Default and UI/Default Font. Mine didn't have either of those, but when I added them all the crashing problems went away and the built game ran flawlessly.
I have the same problem, but I had UI/Default and UI/Default Font already listed. So I still have the problem. Help!!!!!!!!!!!
Yeah on 5.5.0 still exists and crashes none image on launch with that setting...
@rich_seabirdsim I suspect that you're still missing a shader for something in your scene, I don't know which one so you may have to figure that one out yourself.
Answer by SaraCecilia · Dec 14, 2015 at 03:52 PM
Hey everyone, the fix for this is planned for a 5.3 patch, so hopefully by 5.3.1 it will be fixed.
The fix is to load the default shader (the one that makes things pink) so you will still have to include the shader the way you currently do but this will not cause a crash.
Hey Sara, I am still getting the same error, but this workaround and the latest update have had no difference, and it continues to freeze and crash, showing the same error after playing the game for a bit. I think it may be a bug with Unity itself, since I have no infinite loops to cause that kind of freezing, and the crash happens so infrequently both in the editor and standalone builds. Any thoughts or tips?
Fixed it, still a strange bug http://answers.unity3d.com/questions/1111458/unity-freezing-and-crashing-randomly-unable-to-deb.html#answer-1118568
Answer by Zarod · Sep 27, 2017 at 12:24 AM
For those like me that found this solution not to work i would suggest to check if you are using The Audio spatializer. Both editor and build would crash for me (from output.log it seems i lack the audio plugin??? it makes no sense). It has been week but i never noticed because i looked for errors only in the editor logs. Now i'm running my game for half an hour and there are no crashes.
Hope it's helpful, it did seem to solve my problems.
edit:oh yes, using unity 5.5.0f3, very satisfied so far.
Answer by Satsuma1122 · Aug 30, 2020 at 07:05 PM
i have same problem but i have a main menu and i have tried to fix it with this solution exept it did not work and tbh idk wtf is happening when i load scene 1 it is black and crashes when i load scene 2 it does not but one of my 2 vehicles will not move at all i need help