Under review

Supplied Shaderforge code not compiling correctly

moakley 4 months ago • updated 4 months ago 2


      The full code for Shaderforge that is now supplied with the install (1.38) doesn't seem to compile into a .DLL correctly. When I try to use the new compiled DLL it loads as far as the 'new/load' shader screen then crashes when I go into the shader editor itself (you don't have the node screen, but just the rendered shader in the top left hand corner. It then crashes, and reloads if I click on anything.

Here are the error messages I'm currently getting:

When first loading Unity with newly compiled ShaderForge.DLL installed:

NullReferenceException: Object reference not set to an instance of an object
ShaderForge.SF_Evaluator.Evaluate ()
ShaderForge.SF_Editor.OnDisable ()

And when I try to run it and it crashes as I go into the shader editor itself:

IndexOutOfRangeException: Array index is out of range.
ShaderForge.SFPSC_Meta.DrawInner (UnityEngine.Rect& r)
ShaderForge.SFPS_Category.Draw (Single yOffset)
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)

Any suggestion on how to fix this would be gratefully received.

Thank you in advance,


Under review

What version of Unity are you using, and does the same issue happen in a new project?

Hi Joachim,

                      I'm compiling it to be used in Unity 5.6.2p4 at the moment. I've not tried it in a new project yet, I'll do that now and let you know.