Shader warnings are only logged on initial import, but never again - how to see them again later?

My team is having some small issues with shader warnings (a recurring thing over the last few years). For example, sometimes, when I open a project for the first time (or after deleting the library) Unity logs a shader warning to the console related to one of our custom shaders. I then copy paste the warning to our shader developer, who says, that the warning does not appear on his machine and that he can’t be sure if it is fixed after some change. If I clear the Unity console, the shader warning will be lost (as in not be logged again until I delete the library folder). We then try to collectively reproduce the warning again, but in cases where the issue was not fixed, the warning only shows again in seemingly random situations and not even realiably after reimporting all assets.

What we’ve tried:

  • Reimport the shader or materials using the shader
  • Making a change to the shader file to trigger a recompile
  • Ensuring that we have the same target platform in the editor
  • Looking at the inspector of the shader asset and using (“Compile and show code”).

In fact, the inspector did show the warning message while it was still in the Unity console initially, but then later, after doing something like restarting Unity or entering play mode (?) the warning disappeared in both the console and the shader inspector.

Is there any way to force log all warnings from shaders?

I actually tried to use the ShaderUtil API to manually log shader messages, but nothing was returned.

The brute force way is to delete the shader cache from the project’s Library folder.

1 Like