# ArgumentException：高度图分辨率 (1025) 与地形数据 (513) 不匹配

- **ID:** `unity/terrain-heightmap-resolution-mismatch`
- **领域:** unity
- **类别:** data_error
- **错误码:** `TERRAIN-003`
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

导入或分配的高度图纹理分辨率与地形配置的分辨率不匹配（必须为 2 的幂加 1）。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Unity 2021.3 | active | — | — |
| Unity 2022.3 | active | — | — |
| Unity 2023.1 | active | — | — |

## 解决方案

1. ```
   在地形设置中更改地形的高度图分辨率以匹配导入的纹理。例如，如果纹理是 513x513，则将“分辨率”设置为 513。
   ```
2. ```
   使用脚本将高度图纹理重新采样为正确的分辨率：Texture2D resampled = new Texture2D(513, 513); Graphics.ConvertTexture(original, resampled);
   ```

## 无效尝试

- **Manually resize the heightmap texture in an image editor to 1025x1025.** — Unity expects heightmap resolution to be 2^n + 1 (e.g., 513, 1025, 2049). Arbitrary resizing may still be incorrect. (45% 失败率)
- **Delete and recreate the terrain from scratch.** — This is time-consuming and does not address the resolution mismatch if the same texture is used. (20% 失败率)
