TERRAIN-003
unity
data_error
ai_generated
true
ArgumentException: Heightmap resolution (1025) does not match terrain data (513)
ID: unity/terrain-heightmap-resolution-mismatch
90%Fix Rate
87%Confidence
1Evidence
2024-09-12First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Unity 2021.3 | active | — | — | — |
| Unity 2022.3 | active | — | — | — |
| Unity 2023.1 | active | — | — | — |
Root Cause
Importing or assigning a heightmap texture with a resolution that does not match the terrain's configured resolution (must be power of two + 1).
generic中文
导入或分配的高度图纹理分辨率与地形配置的分辨率不匹配(必须为 2 的幂加 1)。
Official Documentation
https://docs.unity3d.com/Manual/terrain-Height.htmlWorkarounds
-
95% success Change the terrain's heightmap resolution in the Terrain Settings to match the imported texture. For example, set 'Resolution' to 513 if the texture is 513x513.
Change the terrain's heightmap resolution in the Terrain Settings to match the imported texture. For example, set 'Resolution' to 513 if the texture is 513x513.
-
85% success Resample the heightmap texture to the correct resolution using script: Texture2D resampled = new Texture2D(513, 513); Graphics.ConvertTexture(original, resampled);
Resample the heightmap texture to the correct resolution using script: Texture2D resampled = new Texture2D(513, 513); Graphics.ConvertTexture(original, resampled);
中文步骤
在地形设置中更改地形的高度图分辨率以匹配导入的纹理。例如,如果纹理是 513x513,则将“分辨率”设置为 513。
使用脚本将高度图纹理重新采样为正确的分辨率:Texture2D resampled = new Texture2D(513, 513); Graphics.ConvertTexture(original, resampled);
Dead Ends
Common approaches that don't work:
-
Manually resize the heightmap texture in an image editor to 1025x1025.
45% fail
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% fail
This is time-consuming and does not address the resolution mismatch if the same texture is used.