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

Error occurred at 2015-04-19_182504.
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:

And here is the stack trace from output_log.txt…

========== OUTPUTING STACK TRACE ==================

014047C8 (space_combat_apr_19_2015)
016DFAB1 (space_combat_apr_19_2015)
RectT::Intersects 014E5EE5
05161753 (Mono JIT Code)
() 0516171B (Mono JIT Code)
() 05161701 (Mono JIT Code)
UnityEngine.UI.Graphic:get_material ()
051613B7 (Mono JIT Code)
() 0516122C (Mono JIT Code)
() 051611AF (Mono JIT Code)
() 0515E82D (Mono JIT Code)
(UnityEngine.UI.CanvasUpdate) 0515E12C
(Mono JIT Code)
() 0515DE38 (Mono JIT Code)
() 051402FB (Mono JIT Code) (wrapper
(object,intptr,intptr,intptr) 100F054D
(mono) mono_set_defaults 1005D812
(mono) mono_runtime_invoke 01324FAE
scripting_gchandle_get_target 013D1239
ScriptingArguments::AddString 013D12AE
ScriptingArguments::AddString 013D12D5
ScriptingArguments::AddString 016E2620
RectT::Intersects 01396675
UserList::AddUser 0142DB81
PlayerMainWndProc 0142F800
PlayerWinMain 01764E98
0179BECF (space_combat_apr_19_2015)
75EA7C04 (KERNEL32)
BaseThreadInitThunk 7774AD1F (ntdll)
RtlInitializeExceptionChain 7774ACEA
(ntdll) RtlInitializeExceptionChain

========== END OF STACKTRACE ===========

**** Crash! ****

Any help is greatly appreciated, thanks!

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.

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.

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.

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