# 着色器错误在'Universal Render Pipeline/Lit'中：无法在第0行打开源文件。当前渲染管线与此着色器不兼容。

- **ID:** `unity/urp-shader-pipeline-mismatch`
- **领域:** unity
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 95%

## 根因

材质或着色器是为URP设计的，但项目使用的是内置渲染管线，反之亦然。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Unity 2022.3 | active | — | — |
| URP 14.0.8 | active | — | — |
| Built-in RP | active | — | — |

## 解决方案

1. ```
   通过Window > Render Pipeline > Universal Render Pipeline > Upgrade Project Materials to URP Materials将项目转换为URP，或手动分配URP兼容的着色器，如'Universal Render Pipeline/Lit'。
   ```
2. ```
   如果保留在内置渲染管线上，通过材质检查器将材质的着色器替换为内置等效项，如'Standard'。
   ```

## 无效尝试

- **** — Simply changing the shader name in the material inspector does not update the underlying shader code; it may still reference URP-specific functions. (80% 失败率)
- **** — Deleting and re-importing the shader file does not fix the pipeline incompatibility; the shader must be rewritten for the correct pipeline. (70% 失败率)
