- Home /
Shader not working in build
Hi,
My game have the ability to change the shaders on the run but here goes the problem: When I build in for my mobile the shaders doesn't seems to load at all.
I already put all the shaders I need in a resources folder with no success, I even tried to put some spheres with the shaders to force the import.
Strange things to note:
-If i build only a level the shaders work fine but if I build with the starting menu it doesn't when I load the first level.
-When I print the name of the shader it is using it's the good one (a toon shader) but the rendering looks like it's a diffuse.
What could it be? Some of you guys already encoutered a similar issue?
Thanks.
Edit: I found that half of it is working actually. The instantiated materials don't change while the others do.
foreach(GameObject npc in npcs)
{
npc.GetComponent<Human>().deadSkin.shader=Shader.Find("Toon/Basic Outline Alpha"); // this works
npc.GetComponentInChildren<SkinnedMeshRenderer>().sharedMaterial.shader=Shader.Find("Toon/Lighted Outline"); // this doesn't
npc.GetComponentInChildren<SkinnedMeshRenderer>().sharedMaterial.color=new Color(0.55f, 0.55f, 0.55f, 1f);
}
I tried with both material and sharedMaterial methods. Again this works if I built the level only but then with LevelLoad it does not.
Answer by tanoshimi · Jun 08, 2015 at 12:27 PM
Go Settings -> Graphics, and add the shaders you need to the "Always Included Shaders" list.
That solved my issue. Thanks a ton! Weirdly enough I have a new one now with one of my shaders being pink and showing warnings on it saying it won't compile. It was working before?! Trying to fix it...
Thanks again!
Edit: I had also to include shaders that were used in Pass in the shader I use.
Dude I love you, was scratching my head with this for quite a while.
DUUDE I JUST LOVE YOU!! SAVED $$anonymous$$Y LIFE!!!!! <3 <3 <3
Answer by tang64gaming · Jun 12, 2020 at 01:53 PM
Hello, I have the same issue still when i put my shader into "Always Included Shaders". If some1 can help me, my project is on android and I use a custom shader which is just a standart with "cull off".