Maximum number (256) of shader global keywords exceeded, keyword _DISTORTION_ON will be ignored. You will have to delete some shaders or make them use less keywords.
Hi everyone, I am trying to learn about effects and have multiple assets and packages in my project, Amplphy shader, color, bloom, Lightweight and High definition render pipeline, with shader graph and visual effects graph. The problem is I am having this error still shows up.
Maximum number (256) of shader global keywords exceeded, keyword _DISTORTION_ON will be ignored. You will have to delete some shaders or make them use less keywords.
I have looked around and people are saying I need to restart unity but the problem still continues.
I also think it is effecting my materials because they are all pink and trying to switch to the lightweight render pipeline does nothing to help.
Any advice would be greatly appreciated. Thank you.
Answer by RobAnthem · Mar 06, 2020 at 11:33 PM
For future reference, this is solved in 2019.1 and newer, but not a simple solution. Go into Visual studios and CTRL+F to search, then use the dropdown menu for replace to find and replace the following.
Replace ALL "multi_compile " with "multi_compile_local "
Replace ALL "shader_feature " with "shader_feature_local "
The reason for this is because unity did not increase the cap of shader keywords with 2019, but instead added a local keyword option for each shader, with a limit of 128 local keywords. For the most part this solves it. HOWEVER It is worth nothing that not prevent global access, ALL lines Shader.Enable/DisableKeyword("keyword")
must be replaced with myMaterial.Enable/DisableKeyword"keyword")
because the Shader call is a global call and the material call is local.
This should 100% solve the maximum exceeded shader keywords error. It has for me, and I have over 700 shaders in my current project.
After done (Replace ALL "multi_compile " with "multi_compile_local ") part of my shaders been crashed and works wrong. Becareful
Answer by zero4444 · Jan 04, 2020 at 11:26 AM
I was told to use this tool to delete unused shaders: https://bitbucket.org/ArtIsDarkGames/shader-keywords-tool-unity3d/src/master/
Answer by Kronnect · May 02, 2020 at 03:44 PM
Replacing all multi_compile to local is risky and prone to break something since many assets use Shader.EnableKeyword and local keywords cannot be used that way. Use Shader Control from the Asset Store and perform find/replace changes with, well, more control.
Does Shader Control work with Unity 2017.4? I'm stuck on that version for now.
It requires 2018.2 or later. However you can download an older version that runs on 2017.4 from kronnect.com website.
Answer by JeffreyStrate · Aug 13, 2020 at 10:22 AM
Das tool geht nich zu 100% man kann aber die shader selber löschen... shader suchen und alles löschen was nicht standart ist