# 7. Terrain Pitfalls
Part of [[Terrain]]. Previous: [[6. Terrain Performance Mobile and Quest]].
> [!note] Verification status
> Items are drawn from the 6000.5 Terrain API docs (indexing, SampleHeight, SetHeightsDelayLOD) and general practice. **Code not compiled in Unity.**
1. **Play mode edits the asset.** Any runtime `SetHeights`/`SetAlphamaps`/`SetTreeInstances` writes into the `TerrainData` asset, and it survives leaving Play mode. Clone it (part 5) or work on a copy.
2. **`SampleHeight` is relative.** Add `terrain.GetPosition().y` for world height. Terrains not at y = 0 expose this bug immediately.
3. **`[y, x]` indexing.** Heights and alphamaps are `[y, x]` (y along world Z). Swapping gives a mirrored diagonal - tests with a square map can hide it if your pattern is symmetric.
4. **Changing heightmap resolution rewrites the height data** (resampled or reset depending on how you change it - not verified per path on 6000.5). Decide resolution before sculpting; keep the source RAW.
5. **`size.y` is a multiplier.** Raising it later makes everything taller. Choose it first.
6. **Seams between tiles.** Use the same Grouping ID + Auto Connect, matching heightmap resolution, and world-space noise (part 1). Sculpt across borders with Terrain Tools.
7. **Tree colliders are opt-in twice.** The prototype prefab needs a collider *and* the Terrain Collider must have tree colliders enabled.
8. **Trees aren't GameObjects.** No per-tree scripts or events. Swap to prefabs near the player if you need interaction.
9. **Detail maps differ by scatter mode.** Changing Detail Scatter Mode changes what your painted numbers mean - repaint or regenerate (part 3).
10. **NavMesh doesn't follow deformation.** Rebake by area or keep deformation cosmetic.
11. **Large binary assets in git.** `TerrainData` `.asset` files and RAWs are multi-MB binaries. Use LFS ([[2. Git LFS]]) and avoid two people editing the same tile (lock it in UVCS, see [[UVCS]]).
12. **Too many layers.** Every extra Terrain Layer costs texture samples per pixel; on Quest keep to 4 per tile and confirm in the Frame Debugger.
13. **Grass overdraw on Quest.** Alpha-tested grass across the screen is the #1 terrain frame killer on mobile GPUs (part 6).
14. **Floating point far from origin.** Huge worlds jitter physics and VR tracking; keep the playable area near the origin or use origin shifting.
15. **Lightmaps and terrain resolution.** Terrain lightmap scale is set on the terrain; a 1 km terrain can eat a huge lightmap. See [[3.Lightmap UVs and Texel Density]].