TERRAIN-003
unity
data_error
ai_generated
true
ArgumentException:高度图分辨率 (1025) 与地形数据 (513) 不匹配
ArgumentException: Heightmap resolution (1025) does not match terrain data (513)
ID: unity/terrain-heightmap-resolution-mismatch
90%修复率
87%置信度
1证据数
2024-09-12首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Unity 2021.3 | active | — | — | — |
| Unity 2022.3 | active | — | — | — |
| Unity 2023.1 | active | — | — | — |
根因分析
导入或分配的高度图纹理分辨率与地形配置的分辨率不匹配(必须为 2 的幂加 1)。
English
Importing or assigning a heightmap texture with a resolution that does not match the terrain's configured resolution (must be power of two + 1).
官方文档
https://docs.unity3d.com/Manual/terrain-Height.html解决方案
-
在地形设置中更改地形的高度图分辨率以匹配导入的纹理。例如,如果纹理是 513x513,则将“分辨率”设置为 513。
-
使用脚本将高度图纹理重新采样为正确的分辨率:Texture2D resampled = new Texture2D(513, 513); Graphics.ConvertTexture(original, resampled);
无效尝试
常见但无效的做法:
-
Manually resize the heightmap texture in an image editor to 1025x1025.
45% 失败
Unity expects heightmap resolution to be 2^n + 1 (e.g., 513, 1025, 2049). Arbitrary resizing may still be incorrect.
-
Delete and recreate the terrain from scratch.
20% 失败
This is time-consuming and does not address the resolution mismatch if the same texture is used.