# ArgumentException: Heightmap resolution (1025) does not match terrain data (513)

- **ID:** `unity/terrain-heightmap-resolution-mismatch`
- **Domain:** unity
- **Category:** data_error
- **Error Code:** `TERRAIN-003`
- **Verification:** ai_generated
- **Fix Rate:** 90%

## 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).

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Unity 2021.3 | active | — | — |
| Unity 2022.3 | active | — | — |
| Unity 2023.1 | active | — | — |

## Workarounds

1. **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.** (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.
   ```
2. **Resample the heightmap texture to the correct resolution using script: Texture2D resampled = new Texture2D(513, 513); Graphics.ConvertTexture(original, resampled);** (85% success)
   ```
   Resample the heightmap texture to the correct resolution using script: Texture2D resampled = new Texture2D(513, 513); Graphics.ConvertTexture(original, resampled);
   ```

## Dead Ends

- **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% fail)
- **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% fail)
