Question by
eball23 · Dec 20, 2019 at 01:53 PM ·
guishaderpost processingexecutablenull exception
Why does Deferred Night Vision work in the editor but not in the .exe?
I added the Deferred Night Vision Effect script to my main camera and it works in the Unity GUI as you can see here:
But when I build the project and run the executable, I get the following:
I looked at the DeferredNightVisionEffect.cs (free Unity asset) and I cannot figure out why it's working in the GUI but not in the executable. The error in output_log.txt is:
ArgumentNullException: Argument cannot be null.
Parameter name: mat
at (wrapper managed-to-native) UnityEngine.Graphics:Internal_BlitMaterial (UnityEngine.Texture,UnityEngine.RenderTexture,UnityEngine.Material,int,bool)
at UnityEngine.Graphics.Blit (UnityEngine.Texture source, UnityEngine.RenderTexture dest, UnityEngine.Material mat, Int32 pass) [0x00000] in <filename unknown>:0
at UnityEngine.Graphics.Blit (UnityEngine.Texture source, UnityEngine.RenderTexture dest, UnityEngine.Material mat) [0x00000] in <filename unknown>:0
at DeferredNightVisionEffect.OnRenderImage (UnityEngine.RenderTexture source, UnityEngine.RenderTexture destination) [0x00015] in [*project_root*]\Assets\Shaders\DeferredNV\DeferredNightVisionEffect.cs:117
(Filename: [*project_root*]/Assets/Shaders/DeferredNV/DeferredNightVisionEffect.cs Line: 117)
Any guidance appreciated, thanks in advance!
ingui.png
(42.9 kB)
inexecutable.png
(35.5 kB)
Comment
Best Answer
Answer by eball23 · Dec 20, 2019 at 04:00 PM
Shader was not being included in the player build. See this article for problem details and solutions.
Hi, I'm having the same problem.
Managed to solve it by including the shader in Project Settings > Graphics and "Always included shaders"
Thanks for the hint!