I use 2019.2 and Standard rendering, and there is still a max of 256 global keywords, that means if you import a lot of different assets from the Unity asset store you will get this error making game not work properly. When is this going to be solved?
At the moment the problem i am having is that certain shaders, Uber shaders from asset store, are rendered black in the build (in editor work fine) and i am not sure if this max global keywords could be the culprit. I tried uber shaders in an empty project and they work fine.
Maximum number (256) of shader global keywords exceeded, keyword will be ignored and black materials
We have local keywords now too, but it requires the shaders to be updated.
Eg shader_feature becomes shader_feature_local, then it doesn’t count towards the global limit anymore.
So i just have to change that in the shader? But to enable or disable keywords shouldnt work as are meant to global shaders, so i understand you must change the C# code also to change Shader.EnableKeyword to material.EnableKeyword?
Hopefully the google doc linked here can provide more info: https://discussions.unity.com/t/711651/5
Sorry it’s not in the proper docs… not sure why that is ![]()
Ah my mistake, it’s in the docs here! Unity - Manual: Declaring and using shader keywords in HLSL
![]()
It is unfortunate that the included shaders do not use local keywords.
It would be nice if they did.
We have been trying to update some included shaders to use the local keywords - are there any shaders in particular you have seen that you think should be using them?
Simple Lit and friends
Trying to deal w/ this in 2019.4LT / HDRP has been ridiculous.
Layered Lit Shaders. This problem has been absolutely KILLING productivity on my project. Please Unity. FIX this issue ASAP.
There’s a long thread in the Shaders sub-forum on this issue: Shader keyword limit
We’re working on it.
Oh please remove this limit. You tempt us with your “Sales” and I cannot even use more than 8 packages.
(Vegetation engine, Vegetation Studio, Lux Waters, Infinity PBR models, UMA and a few other freebies)
FIX this ASAP!!!
For that are looking for a solution: Shader Control | VFX Shaders | Unity Asset Store
In my opinion, this should be a built-in solution, not from the asset store…
Indeed, now in Unity 2020 i get multiple users of my assets report the error message, this is just not working anymore, is like a big bug.
Please do something about it, same thing in Unity 2019.4.5f1 worked fine and in 2020.2 has the exceeded shader keyword issue, seems like an exponential increase in global keywords from Unity side, which is terrible if happen and we have to change everything.
For a quick fix empty Library/ShaderCashe. (not guaranteed to work, but it worked in a couple of my projects)
Edit: The shader keyword limit was increased to 384, so if you are getting this error, consider upgrading Unity. (2021.1.0b2+, 2020.2.3f1+, 2019.4.19f1+)
Edit2: The shader keyword limit was removed in 2021.2.0a16+
+1 Also worked for me !!
Lol, i’m seeing 384 keywords exceeded now . I don’t think they really fixed the root issue here.
Check also this one
https://discussions.unity.com/t/839685
They suggest the limits will essentially be gone soon, which is the best news possible
Just hope gets tested to the limits to make sure all will work fine and not break anything of old
Thank God. I found a work around ( forcing unity to reimport all is a nasty brute force method), but it was very annoying to find .
So what was your workaround? Not seeing any brute force mentions in that link ?
I imported an asset onto a test branch, and it triggered this issue. I have since reverted the changes, and gone back to my main branch. However I still get this error when trying to build now… even though the files are gone? I also deleted the Library/ShaderCache folder… didnt seem to help…?
EDIT: on 2019.4.0 LTS