Copyright © 2026 Unity Technologies
Regarding the shader compilation error, "Couldn't open include file 'Underwater/UnderwaterFog.hlsl'", this is the design of Unity shader system. Keyword defines only control code, and it does not work on other preprocessor directives, like #include directives or #undef directives. Hence, Unity's shader preprocessor fails to compile the code like this on any platform (OpenGL, DX11, etc): #pragma multi_compile_fragment _ SHADER_KEYWORD #undef SHADER_KEYWORD ... #if SHADER_KEYWORD #include "file-that-does-not-exist" #endif This behavior may not be intuitive for users, but this design is hard to change. The backend builds import dependencies per shader, not per shader variant. This makes it hard to support this use case. The workarounds would be to use a shader directive instead of shader variants (or enable/disable the keyword), based on the file's existence.
N.B. From Jukkaj: This bug is not specific to WebGL, but a generic SRP error. I did not want to change the title since experience shows that has a chance of throwing people off since they no longer remember to connect the bug to their earlier memory. After the WebGL part of this issue is fixed, it looks like a more accurate title for this bug would be
"[SRP, OpenGLES3?] Build fails and Shader errors are logged (both in Development and Release builds)"
---------------
Reproduction steps:
1. Open the attached “WebGL bug.zip“ project
2. Build And Run the project
3. Observe the Console
Expected result: The project is built successfully and no errors are thrown
Actual result: Build fails and errors are thrown
Reproducible with: 2022.2.0a1, 2022.3.2f1, 2023.1.0f1
Not reproducible with: 2021.3.27f1
Could not test with: 2022.1.0a1, 2022.1.0a16 (Errors due to downgrading), 2023.2.0a19 (Errors due to upgrading)
Reproduced on: macOS Ventura 13.3.1 (Intel), Windows 10 (by the reporter)
Notes:
Issues you vote on will appear here