0
Sampler2D output of Code node causes NullReferenceException
Using: ShaderForge version , Unity version 5.6.4f1.
Two NullReferenceException errors occur, one is one-time and the other appears to be every editor Update().
One-time error:
Steps to reproduce:
- Create Code node. Inputs do not matter, only the output matters.
- Select the Sampler 2D output type for the Code node.
- Enter any valid code, e.g.
return 1;
as a placeholder. - Create a Texture 2D node.
- Try to connect the Code node's output to the Texture2D node's Tex input.
- Observe the console for the exceptions.
Customer support service by UserEcho
For some reason the report was submitted early. ShaderForge is version 1.36.
The one-time error is:
NullReferenceException: Object reference not set to an instance of an object
ShaderForge.SFN_Tex2d.IsNormalMap ()
ShaderForge.SFN_Tex2d.GetEvaluatedComponentCount ()
ShaderForge.SF_NodePreview.Combine ()
ShaderForge.SF_Node.RefreshValue (Int32 ia, Int32 ib)
ShaderForge.SFN_Tex2d.RefreshValue ()
ShaderForge.SF_Node.OnUpdateNode (NodeUpdateType updType, Boolean cascade)
ShaderForge.SF_NodeConnector.LinkTo (ShaderForge.SF_NodeConnector other, LinkingMethod linkMethod, Boolean registerUndo)
ShaderForge.SF_NodeConnector.LinkTo (ShaderForge.SF_NodeConnector other, LinkingMethod linkMethod, Boolean registerUndo)
ShaderForge.SF_NodeConnector.TryMakeConnection ()
ShaderForge.SF_NodeConnector.CheckConnection (ShaderForge.SF_Editor editor)
ShaderForge.SF_Node.DrawConnections ()
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)
The repeating error is:
NullReferenceException: Object reference not set to an instance of an object
ShaderForge.SFN_Tex2d.get_TextureAsset ()
ShaderForge.SFN_Tex2d.Draw ()
ShaderForge.SF_EditorNodeView.OnLocalGUI (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)
Please see this GIF demonstrating the bug in action: