unity
config_error
ai_generated
true
着色器错误在'Universal Render Pipeline/Lit'中:无法在第0行打开源文件。当前渲染管线与此着色器不兼容。
Shader error in 'Universal Render Pipeline/Lit': failed to open source file at line 0. The current render pipeline is not compatible with this shader.
ID: unity/urp-shader-pipeline-mismatch
95%修复率
90%置信度
1证据数
2023-06-10首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Unity 2022.3 | active | — | — | — |
| URP 14.0.8 | active | — | — | — |
| Built-in RP | active | — | — | — |
根因分析
材质或着色器是为URP设计的,但项目使用的是内置渲染管线,反之亦然。
English
The material or shader is designed for URP but the project is using Built-in Render Pipeline, or vice versa.
官方文档
https://docs.unity3d.com/Packages/[email protected]/manual/upgrading-your-shaders.html解决方案
-
通过Window > Render Pipeline > Universal Render Pipeline > Upgrade Project Materials to URP Materials将项目转换为URP,或手动分配URP兼容的着色器,如'Universal Render Pipeline/Lit'。
-
如果保留在内置渲染管线上,通过材质检查器将材质的着色器替换为内置等效项,如'Standard'。
无效尝试
常见但无效的做法:
-
80% 失败
Simply changing the shader name in the material inspector does not update the underlying shader code; it may still reference URP-specific functions.
-
70% 失败
Deleting and re-importing the shader file does not fix the pipeline incompatibility; the shader must be rewritten for the correct pipeline.