5.4(B12) NullReferenceException - ShaderBindings.gen.cs:222)


I have not come across this error before in 5.3x builds.
Not sure what it all means, have been trying to update Shaders in old project 4.7 to new 5.4.

UnityEngine.Material..ctor (UnityEngine.Shader shader) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/ShaderBindings.gen.cs:222)
GlowEffect.get_blurMaterial () (at Assets/Plugins/Image Based/GlowEffect.cs:62)
GlowEffect.Start () (at Assets/Plugins/Image Based/GlowEffect.cs:123)

UnityEngine.Material..ctor (UnityEngine.Shader shader) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/ShaderBindings.gen.cs:222)
GlowEffect.get_blurMaterial () (at Assets/Plugins/Image Based/GlowEffect.cs:62)
GlowEffect.OnRenderImage (UnityEngine.RenderTexture source, UnityEngine.RenderTexture destination) (at Assets/Plugins/Image Based/GlowEffect.cs:167)

Is this known Unity issue?

@Aras Can you help, need more information?

Show the code for (and around) those GlowEffect lines? Maybe you're trying to create Material by supplying shader code, which is no longer supported?


Line 62:

    m_BlurMaterial = new Material( GlowBlurShader );
Line 123:

if( !blurMaterial.shader.isSupported)

Line 167

//Blurthesmall texture

I can PM the whole code to anyone who knows more?

You maybe correct about your assumption, but how does one know so much has changed with shaders and really its a unity advanced topic

Is the GlowBlurShader reference set up?

Is the shader itself compiling correctly without errors? (select it and check if any errors in the inspector)

Hi Aras,

Thanks for the reply, just checked the reference and it was detached, such a noob Im! the shaders had removed themselves from the script attached to the main camera, probably this was causing the issue, but very strange that it referenced Unity shader binding.

Only thing I get now is below:

Tiled GPU perf. warning: RenderTexture color surface  (257x144) was not cleared/discarded, doing <run with profiler for info>
UnityEngine.Graphics:BlitMultiTap(Texture, RenderTexture, Material, Vector2[])
GlowEffect:FourTapCone(RenderTexture, RenderTexture, Int32) (at Assets/Plugins/Image Based/GlowEffect.cs:136)
GlowEffect:OnRenderImage(RenderTexture, RenderTexture) (at Assets/Plugins//Image Based/GlowEffect.cs:175)

I assume this is "safe" message and nothing to be concerned about?

You only get this warning when active platform is Android or iOS, and OpenGL ES graphics emulation is on. This basically says "yo, what you're doing might have performance problem on mobile GPUs here". Functionally everything will work, but on many mobile GPUs rendering into a render texture without clearing or discarding it first is often a problem.