- Home /
Custom shader turns pink when built
Anybody know why this would happen? I have a simple Diffuse Outline shader that I found on the unity forums, and I'm swapping out the shader when I have a target selected, so the selected target has an outline. It works fine in the editor- but as soon as it's built, the shader stops working- instead of an outline around the target, the target turns pink- as if it's missing its diffuse texture.
Any idea what would cause this? I thought when you built binaries, it pulled in any needed resources.. if that's the case, it should be a 1:1 representation of what I get in the editor, but that's not the case. Any help on this would be appreciated!
Answer by testure · Jul 21, 2011 at 06:31 PM
Okay, so I finally got around to looking into this problem again- and it turned out to be something really simple. I was changing the shader via script, and the shader wasn't in my Resources folder like I thought it was. Moving the shader to resources fixed it, obviously :)
Answer by Coersum · Mar 07, 2014 at 02:14 AM
Another (better imo) way to do it, posted on the forums by *Kaspar Daugaard*, go to the Unity menu "Edit", then select "Project Settings", then go to "Graphics".
Expand "Always Included Shaders", then increase the "size" by 1, then click on the new element selection circle on its right and then select the shader you want to have loaded with your game.
Awesome dude! :D This really made my day, was exactly what i needed thx.
I would french kiss you if I could, you just saved me hours of headbanging on the wall. $$anonymous$$udos!
Answer by Paulius-Liekis · Jun 07, 2011 at 08:58 AM
In theory it should work as you described. You get pink shader when it's unabled to find shader or compile it. Check log after running your build and see if there are any indications what went wrong with your shader.
there are no indications in the log that anything went wrong at all.. just the typical non platform assembly notifications that say "(this message is harmless)"
I'm having the exact same problem, can you please tell me how did you move the shader exactly?
Answer by ozitech · Feb 16, 2017 at 01:58 PM
First make a backup of your project then Delete all folder other than Assets in your project folder then run your project it will take time , then you must have to change platform then make a build and run. It will work 100% sure IA .. Sorry for my bad English :)
Your answer
![](https://koobas.hobune.stream/wayback/20220612095744im_/https://answers.unity.com/themes/thub/images/avi.jpg)