- Home /
Shader not found in my application after build
Hi everyone,
I'm currently stucking on something relative to shaders.
In my scene, I'm adding a shader "Unlit/Transparent" (the one Unity is giving through the editor) to one of my cube (it's for a test) thanks to this script :
myCube.renderer.material.shader = Shader.Find("Unlit/Transparent");
myCube.renderer.material.mainTexture = Resources.Load(myImage) as Texture2D;
It works fine in the Unity Editor but when I'm lauching my built-in appplication, I'm having an error : my shader is not found.
I'm guessing it's a build settings problem (my shader is not exported ?).
Is anybody knowing what's going on ?
Any help would be appreciated. Thanks.
Regards.
Answer by efge · Apr 01, 2011 at 12:37 PM
From the reference:
When building a player, a shader will only be included if it is assigned to a material that is used in any scene or if the shader is placed in a "Resources" folder.
Ok so if I'm correctly understanding, my shader is not included because it is added at runtime. Because it's a Unity shader, am I able to include it manualy in my Resources folder (with a copy/paste for example) or do I have to re-create it (through UniSciTE)? (yeah, dumb question, but I'm a noob).
Well, I copy/pasted it width UniSciTE and it worked wery well.
Sorry for the noob question. Thanks anyway !