- Home /
Missing shader - lens flare shader missing from Unity 5?
Unity 5.
I'm trying to add the Bloom script to my main camera. I had Bloom (Optimized) working but when I switch to Bloom I get an error in the console.
Missing shader in Main Camera (UnityStandardAssets.ImageEffects.Bloom)
UnityEngine.Debug:Log(Object)
UnityStandardAssets.ImageEffects.PostEffectsBase:CheckShaderAndCreateMaterial(Shader, Material) (at Assets/Standard Assets/Effects/ImageEffects/Scripts/PostEffectsBase.cs:18)
UnityStandardAssets.ImageEffects.Bloom:CheckResources() (at Assets/Standard Assets/Effects/ImageEffects/Scripts/Bloom.cs:88)
UnityStandardAssets.ImageEffects.PostEffectsBase:Start() (at Assets/Standard Assets/Effects/ImageEffects/Scripts/PostEffectsBase.cs:88)
When I debug the script the "lensFlareShader" value is null. Where does this value come from? It's public but not available in the Editor. I tried re-importing the Effects standard asset but it didn't help.
Thanks for the help.
I know that might not have anything to do with your particular experience, but today out of nowhere when I opened up Unity (5.1.0p3 Personal), I got this error message for EVERY camera effect I had on my main camera...and I dont use Ressource Loading like you do.
I found this post and saw it had nothing to do with it so I just closed Unity and reopened it and all the errors where gone! Wtf.
So: If you get errors out of nowhere for no reason, just restart Unity. :/ Lame.
Answer by NunSuperior · Mar 14, 2015 at 03:45 PM
Fixed it. This fix also applies to the Antialiasing.cs script and shaders.
The effects scripts don't like running from cameras that are loaded from the "Resources" dynamically using Resources.Load(). They can't find their shaders. So I modified the scripts to load shaders if they are null. Then I copied the shaders to the Resources/Shaders folder.
Bloom.cs
public override bool CheckResources ()
{
CheckSupport (false);
if ( lensFlareShader == null )
lensFlareShader = (Shader) Resources.Load ("Shaders/LensFlareCreate");
...
}
Your answer
Follow this Question
Related Questions
Unity 5: Bloom causes artifacts on Terrain 2 Answers
Glow/bloom in Mobile Unity? 0 Answers
Unity Fast Bloom doesn't work on Android? 1 Answer
Glow/Bloom replacement shader alpha problem 0 Answers
Glow and Bloom Effects on iPhone 3 Answers