Unity 5 toon shaders don't work in Windows standalone build

I’ve had some problems with toon shaders not working properly or at all in Unity 5 standalone builds, and figured I’d test it out in a controlled environment. So I created a fresh Unity 5 project, imported everything from the Effects asset package, created a Cube in the scene and assigned a new material using the Toon/Lit Outline shader. This is what appears in the Editor:

alt text

However, I get this in a Windows Standalone build:

alt text

I also get

Shader 'Toon/Basic Outline': fallback shader 'Toon/Basic' not found
WARNING: Shader Unsupported: 'Toon/Basic Outline' - Setting to default shader.
Shader 'Toon/Basic Outline': fallback shader 'Toon/Basic' not found
WARNING: Shader Unsupported: 'Toon/Basic Outline' - Setting to default shader.
Setting up 1 worker threads for Enlighten.
  Thread -> id: 2a70 -> priority: 1 

in the output_log.txt of the build. The shaders are all certainly in the project in Standard Assets, so are the toon shaders broken in Unity 5 now? Although I can’t get them to generate again, I was getting warnings saying

Fixed function TexGen used; it doesn't do anything now

for these shaders. I read that Unity took TexGen support out in Unity 5 because it was never used, yet their built-in shaders rely on it? Are there any fixes for this at all?

I fixed this by commenting out line 43 in the outline shader ‘ToonShading/Shaders/ToonBasicOutline.shader’

UsePass "Toon/Basic/BASE"

I’m using ToonLitOutline, which already includes the outline pass and ToonLit pass. So in that case I don’t see the need for that line. But if you are using ToonBasicOutline then this will break it.

I had this problem with my custom toon shaders. My fix was:

  1. Make sure you have the correct #pragma target 3.0 or 5.0 for Dx11 in your custom shader code.
  2. Made sure toon shaders standard package was properly downloaded and installed
  3. Went to Edit - Project Settings -Graphics and in there is a list of shaders that you can drag and drop. I think its called built in shaders box. I just dragged the 4 standard toon shaders into it.
  4. Lastly I created a “Resources” folder in the assets folder and copied and pasted my custom shaders into it. Didn’t need to paste the standard toon shaders in it.

My build no longer has the problem with the outline and whole shader missing. Not sure if all these solutions will work for you but all 4 solutions was necessary for me.

I’m 80% sure solution 3 will do the trick because of your “Shader not found errors.”

I also had a similar problem with the outline shader. I modified the outline width lower range to be 0.00001 and the standalone did not like that. I just changed that into a float and it all works fine now.