- Home /
Unity shader compile error. Shader error in 'Standard' too many math instructions for sm2.0
When trying to build in Unity I'm getting the error: shader error in 'standard' too many math instructions for sm2.0 (65 needed, max is 64). Try #pragma target 3.0 at /Program Files/Unity/Editor/Data/CGIncludes/UnityStandardCore.cginc(424) (on d3d9).
I don't use any custom shaders in my project, so this seems a bit strange. I've already tried restarting unity and my computer. Then I thought updating unity might help, I was using 5.6.1, and downloaded the new version, 2017.1.0, but to no avail. Something to note is that this error does not happen 100% of the time, and it seems like it happens most when I first open unity. I can use the play button in the editor and it seems to run fine. I also tried deleting my library and letting unity create a new one.
Furthermore, when building, I had task manager open and I took this screenshot of the cpu usage.
It seems strange that the shader compilers would take up this much cpu when I'm simply using the default shaders. I have an i7 6700 for reference.
I also looked at the file that the error message pointed to and here are the relevant lines:
423 half4 c = UNITY_BRDF_PBS (s.diffColor, s.specColor, s.oneMinusReflectivity, s.smoothness, s.normalWorld, -s.eyeVec, gi.light, gi.indirect); 424 c.rgb += Emission(i.tex.xy);
So maybe it has to do with emission somehow? I only have one material with emission and it appears fine when the build does work or if I run from the editor.
Thanks in advance for any help!
Answer by jkarabinos · Jul 13, 2017 at 06:05 PM
After a couple hours of narrowing the problem I have finally fixed it.
For some reason changing the mode from mixed to realtime on my point lights solved the issue. Note that you have to regenerate the lighting before the build will work.
Hope this helps someone out!
Your answer
Follow this Question
Related Questions
how can I load PC,linux & Mac standalone module if I already installed the whole Unity???? 2 Answers
How to force the compilation of a shader in Unity? 5 Answers
Custom Shader not working on build (Windows and URP) 0 Answers
I get an error on build but not when I run the game in the Editor. iPhone. 1 Answer
Material/Shader issue 0 Answers