+8
Fixed

shader forge crash when playing scene in editor

andrew marchal 8 years ago updated by Wenceslao Villanueva Jr 7 years ago 23

Hello, Just upgraded to 5.4.0f2. shader forge works fine until i hit play in my scene. at that point sf will become frozen, and stop drawing all the nodes, all i see is some of the ui and the connecting lines. at this point i can't even close the window, i have to relaunch unity for it to be usable again.

Answer

+3
Answer
Fixed

Actually, just found the issue! This has now been fixed in 1.29

here is the error that pops up:

NullReferenceException: Object reference not set to an instance of an object

ShaderForge.SF_PassSettings.OnLocalGUI (Int32 yOffset, Int32 in_maxWidth)
ShaderForge.SF_Editor.DrawPreviewPanel (Rect r)
ShaderForge.SF_Editor.OnGUI ()

System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

Same problem (and message) here unfortunately. Just bought ShaderForge today and absolutely loving it, but this is preventing me from using it productively :-/ Hope it can be fixed.

Under review

Does it happen with every shader or specific ones?

+1

its any shader for me. Just updated to 5.4.1f1 and the issue still is still there.

Any shader; as a test I created a new 'unlit' shader (assuming this one would be the simplest) and assigned it to a new capsule primitive in a new scene. Hitting play/stop on Unity the first time was Ok. Hitting play a second time caused the ShaderForge window to crash.



After the crash...


Console output:


Full detail on clicking on of these entries:

NullReferenceException: Object reference not set to an instance of an object

ShaderForge.SF_PassSettings.OnLocalGUI (Int32 yOffset, Int32 in_maxWidth)
ShaderForge.SF_Editor.DrawPreviewPanel (Rect r)
ShaderForge.SF_Editor.OnGUI ()
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)


Looks like an issue with SF_PassSettings ?


I repeated this after restarting Unity. Again, it was the *second press* of 'Play' that crashed the ShaderForge window. Some state not being reset upon stop?


I was able to replicate this with the same simple procedure on both:

- Unity 5.3.4f1 on MacOS 10.11.6

- Unity 5.4.0.f2 on Windows 10


The main Unity window does not crash and remains responsive. The ShaderForge window does crash and cannot be interacted with at all; even moved or resized.

+1

Sorry, Chris is correct. It's the second time you hit play. my apologies on the poor intial repro reporting.

+1

I can confirm that Shaderforge breaks on the second 'play'.

+1

same here ! It happens almost every time i'm switching in playmode


+1

Just make sure you keep the shader forge window in a spot where you can see the inspector window's "open with shader forge" button. Because if you can get to that button, it'll get your shader forge window back operational again (it'll cure this error). But if you happen to not be able to get to that oh-so-wonderful button because the shader forge window is covering it up, you have to click the Window->Layout->Default to reset Unity to default window layout, which shuts down shader forge (and cures this error)... or you can restart Unity.

+1

I have noticed (and you can see it in the screenshots above) that during the "crash", the "Blending" tab and all tabs below it are gone. So I'm guessing this glitch is somewhere in the code between the drawing of the "Geometry" button, and the drawing of the "Blending" button. But I really don't know for sure.

As I am new to ShaderForge, any idea when we might expect a resolution on this?
It's clearly a fantastic bit of software but unfortunately this bug is a major blocker on productivity for me.

+1

I think this issue is now on Joachim's radar so hopefully pretty soon. He's got a lot on his plate, but he has been pretty good about sorting out crash stuff once he is aware of it.

+1

This bug also occurs when recompiling occurs on the scripts in your game, if such recompilation occurs while the game is in play mode (without leaving / re-entering play mode). So in other words, if you leave the game in play mode, modify a .cs file somewhere, and while still in play mode it recompiles the game, SF will crash with this same error... and yes it does look like it happens on the second recompilation. @Christopher Hatton, I wouldn't hold your breath.

Same issue, same repro steps. I posted here because I found this thread second.

http://shaderforge.userecho.com/topics/1204-shaderforge-editor-glitch/


My workflow is work on shader, hit play once, work on shader, close it, hit play, stop, re-open shader... Yea, not optimal. Bought ShaderForge a year ago and this is the first time I've had time to play with it.

Same here. In extreme situations the shader may be deleted too :/

I'm getting the same bug. If it helps, it's on Win10 with UI scaling at 150% on a 4k monitor. I wonder if that could be related?

I'm on Win10 also with normal UI scaling and normal monitor, 5.4.1f1. Perhaps everyone should post their operating system and version, because the dev seems to be unable to reproduce this error on his end.

I've got it reproducing now, now I've just got to figure out why it happens. It's a very strange error I'm afraid :(

The blending panel on the left goes null when you press play, for whatever reason. None of the other panels do the same. Looking into it now anyhow

It actually seems like this might be something on Unity's end. It's not only the blending category that goes null, it's even more than that. I think I remember seeing a bug report that Unity has flagged as active. I guess a workaround I could do now is to simply save your shader and then kill SF when you press play, which at least is better than getting a bunch of errors, perhaps?

+3
Answer
Fixed

Actually, just found the issue! This has now been fixed in 1.29

awesome ! looking forward to it! thank joachim !