# AI Terrain — Unity Extension

AI Terrain (com.ivanmurzak.unity.mcp.terrain) — Terrain authoring — create terrains, sculpt and sample heights, manage layers, paint textures, scatter trees/details, and stitch neighbours. An AI Game Developer extension for Unity that adds 4 capabilities through RQL (no extra MCP tools).

_Last updated: 2026-10-17_

## At a glance

| Field | Value |
| --- | --- |
| Capabilities | 4 capabilities |
| Version | 2.0.0 |
| Package id | com.ivanmurzak.unity.mcp.terrain |
| Engine | Unity · Unity 2022.3+ |
| Base plugin | com.ivanmurzak.unity.mcp |
| Wraps | com.unity.modules.terrain |
| Repository | https://github.com/IvanMurzak/Unity-MCP/blob/main/extensions/Terrain/README.md |
| RQL sources | terrain |
| RQL functions | terrain.heights, terrain.heightStats, terrain.heightAt |
| RQL types | Terrain, TerrainData, TreePrototype, DetailPrototype |

## How it works

Adds no MCP tools: it contributes an RQL module with the terrain source, the terrain.heights, terrain.heightStats, terrain.heightAt functions and adapters for Terrain, TerrainData, TreePrototype, DetailPrototype. That powers 4 capabilities the agent reaches through rql-query / rql-mutate.

- Create terrains — Create a Terrain with its TerrainData asset, set its size and heightmap resolution, and stitch neighbouring tiles together. RQL: `terrain | call Create("Island", "Assets/Terrain/Island.asset", 257, "(500, 120, 500)")`
- Sculpt & sample heights — Raise or flatten regions, write a whole height grid, and sample heights or height statistics anywhere. RQL: `objects | get components | where $ is Terrain | call SetHeights(0.6, 100, 100, 32, 32)`
- Paint texture layers — Create TerrainLayer assets, add or remove layers, and paint them onto areas of the terrain. RQL: `objects | get components | where $ is Terrain | call PaintLayer(1, 1.0, 0, 0, 64, 64)`
- Trees & details — Add tree and detail prototypes, scatter trees randomly or at exact points, and clear them. RQL: `objects | get components | where $ is Terrain | call PlaceTrees(0, 200, 0.1, 0.1, 0.5, 0.5)`

## Install

Requires the base plugin com.ivanmurzak.unity.mcp. After installing, the RQL module loads with the package — the agent sees it in rql-schema.

```bash
openupm add com.ivanmurzak.unity.mcp.terrain
```

## When to ask the AI for it

Ask for landscape and open-world ground — hills, painted texture layers, scattered foliage.

Not sure if it's installed? Ask the agent to run rql-schema — the terrain source only exists when the package is present.

## Example prompts

1. Create a 500×500 terrain and raise a gentle hill in the centre.
2. Add a grass and a rock terrain layer, then paint rock onto the steep slopes.

---

Source (HTML): https://ai-game.dev/docs/extensions/unity/terrain
