Graphics.Blit causes unity editor crash until Reimport All is done.

As the title suggests, the editor runs fine for a little while, and when the game is built it has no problems running however it will then find itself in a state where any call to Graphics.Blit causes the editor to crash.

The issue has been present in all 5.5.1 versions made available so far. I have sent a bug report too but never received any feedback on any bugs submitted so far so also trying here. Here is a video of the reported behaviour:

Any advice on how to avoid this problem would be greatly appreciated. The issue is fixed temporarily by doing reimport all, however as this takes 5 to 10 minutes at the moment, I’d rather avoid doing this.

1 Like

Having similar issues… haven’t really nailed down the cause or a solid workaround, but Graphics.Blit is certainly causing crashes since upgrading from 5.4x to 5.5x

Seems to be only certain calls though - we call Graphics.Blit every frame as standard, then occasionally use it to do one off effects and such. It’s only the one off effects that cause crashes, the per frame calls have yet to cause any issues.

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

0x00000001407E9435 (Unity) ImageFilters::Blit
0x00000001407F84F2 (Unity) ImageFilters::Blit
0x0000000141187394 (Unity) Graphics_CUSTOM_Internal_BlitMaterial
0x000000002C7DB9A4 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Graphics:Internal_BlitMaterial (UnityEngine.Texture,UnityEngine.RenderTexture,UnityEngine.Material,int,bool)
0x000000002C7DB879 (Mono JIT Code) [C:\buildslave\unity\build\artifacts\generated\common\runtime\GraphicsBindings.gen.cs:2212] UnityEngine.Graphics:Blit (UnityEngine.Texture,UnityEngine.RenderTexture,UnityEngine.Material,int) 
0x000000002C7DB78E (Mono JIT Code) [C:\buildslave\unity\build\artifacts\generated\common\runtime\GraphicsBindings.gen.cs:2207] UnityEngine.Graphics:Blit (UnityEngine.Texture,UnityEngine.RenderTexture,UnityEngine.Material) 
0x0000000033F44847 (Mono JIT Code) [C:\Workspaces\KingsSchool\Trunk\UnityProject\Assets\Code\Client\Areas\Transitions\TransitionCircleFade.cs:110] Client.Areas.Transitions.TransitionCircleFade:Render () 
0x0000000033F44AB0 (Mono JIT Code) (wrapper delegate-invoke) System.Action:invoke_void__this__ ()
0x000000002C7D2A9E (Mono JIT Code) [C:\Workspaces\KingsSchool\Trunk\UnityProject\Assets\Code\Tech.Unity\FinalCamera.cs:47] FinalCamera:OnPostRender () 
0x00000000008A6C52 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007FFB131E54A3 (mono) [c:\buildslave\mono\build\mono\mini\mini.c:4937] mono_jit_runtime_invoke 
0x00007FFB131383DD (mono) [c:\buildslave\mono\build\mono\metadata\object.c:2623] mono_runtime_invoke 
0x0000000141208CDF (Unity) scripting_method_invoke
0x0000000140E39AE5 (Unity) ScriptingInvocation::Invoke
0x000000014120D222 (Unity) MonoBehaviour::HandleNotifications
0x00000001407AEFE3 (Unity) MessageHandler::HandleMessage
0x00000001407AF434 (Unity) GameObject::SendMessageAny
0x00000001407AF672 (Unity) Unity::Component::SendMessageAny
0x00000001407E52A8 (Unity) Camera::PostMultiCustomRender
0x000000014080B9CE (Unity) Camera::smile:oRender
0x000000014081C81D (Unity) Camera::Render
0x000000014081E1DA (Unity) Camera::Render
0x000000014086E5DE (Unity) RenderManager::RenderCameras
0x0000000141554C68 (Unity) RenderGameViewCameras
0x0000000141088503 (Unity) EditorGUIUtility_CUSTOM_INTERNAL_CALL_RenderGameViewCamerasInternal
0x000000002A59A3E4 (Mono JIT Code) (wrapper managed-to-native) UnityEditor.EditorGUIUtility:INTERNAL_CALL_RenderGameViewCamerasInternal (UnityEngine.RenderTexture,int,UnityEngine.Rect&,UnityEngine.Vector2&,bool)
0x000000002A59A2B4 (Mono JIT Code) [C:\buildslave\unity\build\artifacts\generated\common\editor\EditorGUIUtilityBindings.gen.cs:577] UnityEditor.EditorGUIUtility:RenderGameViewCamerasInternal (UnityEngine.RenderTexture,int,UnityEngine.Rect,UnityEngine.Vector2,bool) 
0x000000001E8D8DF7 (Mono JIT Code) [C:\buildslave\unity\build\Editor\Mono\GameView\GameView.cs:729] UnityEditor.GameView:OnGUI () 
0x00000000008A6C52 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007FFB131E54A3 (mono) [c:\buildslave\mono\build\mono\mini\mini.c:4937] mono_jit_runtime_invoke 
0x00007FFB131383DD (mono) [c:\buildslave\mono\build\mono\metadata\object.c:2623] mono_runtime_invoke 
0x00007FFB1313E7CB (mono) [c:\buildslave\mono\build\mono\metadata\object.c:3838] mono_runtime_invoke_array 
0x00007FFB130FCDDB (mono) [c:\buildslave\mono\build\mono\metadata\icall.c:2749] ves_icall_InternalInvoke 
0x00000000008704C7 (Mono JIT Code) (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
0x000000000086E622 (Mono JIT Code) [/Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222] System.Reflection.MonoMethod:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) 
0x000000001C727A1F (Mono JIT Code) [/Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115] System.Reflection.MethodBase:Invoke (object,object[]) 
0x000000001C727965 (Mono JIT Code) [C:\buildslave\unity\build\Editor\Mono\HostView.cs:249] UnityEditor.HostView:Invoke (string,object) 
0x000000001C72780A (Mono JIT Code) [C:\buildslave\unity\build\Editor\Mono\HostView.cs:242] UnityEditor.HostView:Invoke (string) 
0x000000001E8D5FB3 (Mono JIT Code) [C:\buildslave\unity\build\Editor\Mono\HostView.cs:212] UnityEditor.HostView:InvokeOnGUI (UnityEngine.Rect) 
0x000000001E8B681D (Mono JIT Code) [C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:352] UnityEditor.DockArea:OnGUI () 
0x00000000008A6C52 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007FFB131E54A3 (mono) [c:\buildslave\mono\build\mono\mini\mini.c:4937] mono_jit_runtime_invoke 
0x00007FFB131383DD (mono) [c:\buildslave\mono\build\mono\metadata\object.c:2623] mono_runtime_invoke 
0x0000000141208CDF (Unity) scripting_method_invoke
0x0000000140E39AE5 (Unity) ScriptingInvocation::Invoke
0x0000000140B564CF (Unity) MonoBehaviourDoGUI
0x0000000140B4A7A0 (Unity) IMGUIModule::MonoBehaviourDoGUI
0x000000014120FE5A (Unity) MonoBehaviour::smile:oGUI
0x000000014153D180 (Unity) GUIView::OnInputEvent
0x0000000140078BB3 (Unity) GUIView::ProcessInputEvent
0x0000000141538F6A (Unity) GUIView::smile:oPaint
0x000000014153B570 (Unity) GUIView::RepaintAll
0x000000014148C3D4 (Unity) Application::UpdateScene
0x000000014148D7FF (Unity) Application::UpdateSceneIfNeeded
0x00000001414960B4 (Unity) Application::TickTimer
0x0000000141558FFE (Unity) FindMonoBinaryToUse
0x000000014155A621 (Unity) WinMain
0x0000000141875DD4 (Unity) strnlen
0x00007FFB47198364 (KERNEL32) BaseThreadInitThunk
0x00007FFB48D170D1 (ntdll) RtlUserThreadStart

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

So I made some changes to my code in an area that used Graphics.Blit but had been working fine since the 5.5.2 update. After my minor changes (mostly changing the shader), it started crashing 100%.

I extracted the relevant code and assets into a small project to try and isolate the issue, but the small project worked flawlessly. I then alt-tabbed back to my original project and ran it again, without changes it now worked fine.

There’s definitely some weird data/state caching going on that’s causing some serious issues.

Can @Aras or someone from the Unity graphics team have a look at this?

This time it was crashing 100%, so I stepped through with a debugger, and everything worked fine, but Unity did log the warning “Material doesn’t have a color property ‘_Color’”

The line number refered to was the methods closing brace after the call to Graphics.Blit…

I’m not trying to access a color property anywhere, but it looks like Graphics.Blit is doing so internally. Is this a change that was put in since 5.4?

Here’s the stack trace

Material doesn't have a color property '_Color'
UnityEngine.Material:INTERNAL_CALL_GetColor(Material, Int32, Color&)
UnityEngine.Material:GetColor(Int32) (at C:\buildslave\unity\build\artifacts\generated\common\runtime\ShaderBindings.gen.cs:349)
UnityEngine.Material:GetColor(String) (at C:\buildslave\unity\build\artifacts\generated\common\runtime\ShaderBindings.gen.cs:345)
UnityEngine.Material:get_color() (at C:\buildslave\unity\build\artifacts\generated\common\runtime\ShaderBindings.gen.cs:327)
Client.Areas.Transitions.TransitionCircleFade:Render() (at Assets\Code\Client\Areas\Transitions\TransitionCircleFade.cs:109)
FinalCamera:OnPostRender() (at Assets\Code\Tech.Unity\FinalCamera.cs:47)
UnityEditor.EditorGUIUtility:INTERNAL_CALL_RenderGameViewCamerasInternal(RenderTexture, Int32, Rect&, Vector2&, Boolean)
UnityEditor.EditorGUIUtility:RenderGameViewCamerasInternal(RenderTexture, Int32, Rect, Vector2, Boolean) (at C:\buildslave\unity\build\artifacts\generated\common\editor\EditorGUIUtilityBindings.gen.cs:577)
UnityEditor.GameView:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\GameView\GameView.cs:729)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
System.Reflection.MethodBase:Invoke(Object, Object[]) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView:Invoke(String, Object) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:249)
UnityEditor.HostView:Invoke(String) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:242)
UnityEditor.HostView:InvokeOnGUI(Rect) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:212)
UnityEditor.DockArea:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:352)

(Apologies for hijacking your thread somewhat andrew210…)

No problem! There is a bug open on this at the moment, as of the latest patch (5.5.2p1?) I haven’t been able to recreate this bug again though