Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

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

Discussion in '5.4 Beta' started by MrEsquire, Mar 30, 2016.

  1. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Hi,

    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.

    Code (CSharp):
    1. NullReferenceException
    2. UnityEngine.Material..ctor (UnityEngine.Shader shader) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/ShaderBindings.gen.cs:222)
    3. GlowEffect.get_blurMaterial () (at Assets/Plugins/Image Based/GlowEffect.cs:62)
    4. GlowEffect.Start () (at Assets/Plugins/Image Based/GlowEffect.cs:123)
    5.  
    6. NullReferenceException
    7. UnityEngine.Material..ctor (UnityEngine.Shader shader) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/ShaderBindings.gen.cs:222)
    8. GlowEffect.get_blurMaterial () (at Assets/Plugins/Image Based/GlowEffect.cs:62)
    9. GlowEffect.OnRenderImage (UnityEngine.RenderTexture source, UnityEngine.RenderTexture destination) (at Assets/Plugins/Image Based/GlowEffect.cs:167)
    Is this known Unity issue?
    Thanks
     
  2. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    @Aras Can you help, need more information?
     
  3. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    295
    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?
     
  4. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Sure:

    Code (CSharp):
    1. Line 62:
    2.  
    3.     m_BlurMaterial = new Material( GlowBlurShader );
    4. Line 123:
    5.  
    6. if( !blurMaterial.shader.isSupported)
    7. enabled=false;
    8.  
    9. Line 167
    10.  
    11. //Blurthesmall texture
    12. floatextraBlurBoost=Mathf.Clamp01((glowIntensity-1.0f)/4.0f);
    13. blurMaterial.color=newColor(1F,1F,1F,0.25f+extraBlurBoost);
    14.  
    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
     
  5. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Is the GlowBlurShader reference set up?

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

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    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:

    Code (CSharp):
    1. Tiled GPU perf. warning: RenderTexture color surface  (257x144) was not cleared/discarded, doing <run with profiler for info>
    2. UnityEngine.Graphics:BlitMultiTap(Texture, RenderTexture, Material, Vector2[])
    3. GlowEffect:FourTapCone(RenderTexture, RenderTexture, Int32) (at Assets/Plugins/Image Based/GlowEffect.cs:136)
    4. GlowEffect:OnRenderImage(RenderTexture, RenderTexture) (at Assets/Plugins//Image Based/GlowEffect.cs:175)
    I assume this is "safe" message and nothing to be concerned about?
     
  7. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    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.