terrain
Skill15 starsChanged 5 months agoMITView on GitHub
Skill for AI agents authoring Unity Terrain (heightmaps, splatmaps, trees, neighbor stitching) in a project through the unity-open-mcp MCP server. This domain is embedded in the bridge and opt-in. Its tools use the built-in engine modules (UnityEngine.TerrainModule for Terrain / TerrainData, UnityEngine.CoreModule for TreePrototype / TerrainLayer) — no Unity package install is required, and they compile into every bridge build. Its tool group is hidden from ListTools until the connected session activates it. - Unity Editor is open with the…
In this repository26 other files it gives its agents.
- AGENTS.mdAGENTS.md
- demo/AGENTS.mdAGENTS.md
- hub/AGENTS.mdAGENTS.md
- mcp-server/AGENTS.mdAGENTS.md
- scripts/AGENTS.mdAGENTS.md
- skills/AGENTS.mdAGENTS.md
- animationSkill
- audioSkill
- cinemachineSkill
- constraintsSkill
- input-simulationSkill
- inputsystemSkill
- lightingSkill
- memoryprofilerSkill
- navigationSkill
- particlesystemSkill
- probuilderSkill
- shadergraphSkill
- splinesSkill
- spriteatlasSkill
- textureSkill
- tilemapSkill
- timelineSkill
- uiSkill
- vfxSkill
- unity-open-mcpSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 26
All five tools share the unity_open_mcp_terrain_ prefix and one tool group:
- Very specific: line 40
All five tools are mutating and accept the standard paths_hint.
- Very specific: line 44
Every mutating tool requires a non-empty paths_hint scoped to the host scene path — the gate has no whole-project fallback.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Unity Open MCP — Terrain Extension
Skill for AI agents authoring Unity Terrain (heightmaps, splatmaps, trees,
neighbor stitching) in a project through the unity-open-mcp MCP server.
This domain is embedded in the bridge and opt-in. Its tools use the built-in engine modules (
UnityEngine.TerrainModulefor Terrain / TerrainData,UnityEngine.CoreModulefor TreePrototype / TerrainLayer) — no Unity package install is required, and they compile into every bridge build. Its tool group is hidden fromListToolsuntil the connected session activates it.
Preconditions
- Unity Editor is open with the target project.
unity_open_mcp_pingreturnsconnected: true.- The
terraintool group is activated — callunity_open_mcp_manage_tools(action="activate", group="terrain")before invoking any Terrain tool. Fresh sessions start with two default-on groups (coreandgate-and-verify); activate the other groups you need on demand. Because these types are built-in,capabilitiesalways reports theterraingroup asavailable: true(nodomainDefine).
Tool prefix
All five tools share the unity_open_mcp_terrain_ prefix and one tool group:
unity_open_mcp_terrain_create— allocate TerrainData (+ optional.asset) and a Terrain GameObject.unity_open_mcp_terrain_set_heights— set a heightmap region from a 2D array of normalized 0-1 values.unity_open_mcp_terrain_paint_layer— paint one terrain layer's splat from a 2D alphamap; seeds a newTerrainLayerwhen the index is new.unity_open_mcp_terrain_place_trees— place tree instances (position + scale- rotation) against a prototype index; seeds a prototype from a prefab when the index is new.
unity_open_mcp_terrain_set_neighbors— set the top / bottom / left / right neighbor Terrains for LOD stitching.
All five tools are mutating and accept the standard paths_hint; they run the
full gate path. There are no read-only members in this group — read terrain
state with unity_open_mcp_component_get / unity_open_mcp_object_get_data.
Every mutating tool requires a non-empty paths_hint scoped to the host scene
path — the gate has no whole-project fallback.
Large arrays: tile, don't dump
Heightmap and splat arrays are capped at 513×513 per call. Larger arrays
return invalid_heights_array / invalid_alphamap_array with a tiling hint
pointing you at x_offset / y_offset region writes.
Work in tiles: a 129×129 default heightmap is a single call; a 513×513 region
is one call; a full 2049×2049 heightmap is ~16 calls (e.g. four 513-row bands
of four 513-column tiles each, advancing x_offset and y_offset per call).
This keeps each mutation fast, gate-cheap, and reviewable — the gate's
checkpoint → mutate → validate → delta flow rewards small, scoped writes over
one giant dump.
Canonical workflow: a textured terrain with trees
- Create —
unity_open_mcp_terrain_createwithheightmap_resolution: 129(default),width/length/heightin world units, optionalpositionandasset_path(when you want the TerrainData saved to disk). Returns the terrain'sinstance_id+path— capture them for the next calls. - Sculpt —
terrain_set_heightswithx_offset/y_offsetand a 2Dheightsarray of normalized 0-1 values. Tile large changes (see above). - Texture —
terrain_paint_layerper layer. Passlayer_index, analphamap(2D weights), and (for a new index)layer_pathto seed a newTerrainLayerasset. Repeat per layer (up to 8 for the standard terrain shader). - Plant —
terrain_place_treeswith atree_prototype_index, aninstancesarray ({position, height_scale, width_scale, rotation}), and (for a new index)prototype_prefab_pathto seed the prototype from a.prefab. - Stitch (multi-tile worlds) —
terrain_set_neighborsto wire the four sides for LOD continuity across adjacent terrains.
Coordinate systems
- Heightmap values: normalized 0-1 (0 = sea level, 1 = the TerrainData's
heightin world units). The 2D array is row-major[[row0...],[row1...],...]; row index is Y (heightmap Z), column index is X (heightmap X). - Alphamap values: normalized 0-1 weights per layer. Each cell's weights
across all layers should sum to 1 for correct blending (the tool writes one
layer per call; re-read the slice with
component_getif you need to blend multiple layers in one region). - Tree positions: normalized 0-1 on the terrain surface —
position: "x,z"where(0,0)is one corner and(1,1)the opposite. Y is sampled automatically. - Neighbors: resolved by
instance_id>path(a Terrain GameObject's hierarchy path). A side with no resolver clears it; a terrain cannot be its own neighbor.
Asset vs scene mutations
terrain_createwith anasset_pathmutates an asset (the TerrainData.asset) and the scene (it adds the Terrain GameObject).paths_hintmust cover both the scene path and the.assetpath so the gate validates both. Whenasset_pathis omitted, the TerrainData is in-scene only and is not saved to disk — fine for prototyping, lost on scene close without a save.terrain_paint_layerwith a newlayer_pathunderAssets/creates a.terrainlayerasset — include it inpaths_hintalongside the scene path.terrain_set_heights,terrain_place_trees, andterrain_set_neighborsmutate only the scene's TerrainData / Terrain —paths_hintis the host scene path.
Common recipes
A 129×129 terrain with a central hill
1. terrain_create { terrain_name: "HillTerrain", heightmap_resolution: 129,
width: 500, length: 500, height: 200,
paths_hint: ["Assets/Scenes/Main.unity"] }
→ capture instance_id / path
2. terrain_set_heights { instance_id: <id>, x_offset: 48, y_offset: 48,
heights: [[0.1,0.2,...33 values...],[0.2,0.4,...],...33 rows],
paths_hint: ["Assets/Scenes/Main.unity"] }A 33×33 region at offset (48,48) sits in the middle of a 129×129 heightmap.
Two grass + rock layers
1. terrain_paint_layer { instance_id: <id>, layer_index: 0,
alphamap: [[1,...],[1,...],...], layer_path: "Assets/Terrain/Grass.terrainlayer",
paths_hint: ["Assets/Scenes/Main.unity", "Assets/Terrain/Grass.terrainlayer"] }
2. terrain_paint_layer { instance_id: <id>, layer_index: 1,
alphamap: [[0.2,...],[0.5,...],...], layer_path: "Assets/Terrain/Rock.terrainlayer",
paths_hint: ["Assets/Scenes/Main.unity", "Assets/Terrain/Rock.terrainlayer"] }Each terrain_paint_layer call writes one layer's weights into the region; the
existing layers keep their weights in the slice.
Scatter trees from a prefab
terrain_place_trees { instance_id: <id>, tree_prototype_index: 0,
prototype_prefab_path: "Assets/Trees/Pine.prefab",
instances: [
{ position: "0.5,0.5", height_scale: 1, width_scale: 1, rotation: 0 },
{ position: "0.6,0.5", height_scale: 0.9, width_scale: 1, rotation: 45 }
],
paths_hint: ["Assets/Scenes/Main.unity"] }The first call for a new prototype index seeds it from the prefab; subsequent
calls with the same index reuse it (omit prototype_prefab_path).
Stitch a 2×2 terrain grid
# Top-left tile's right neighbor = top-right tile, bottom neighbor = bottom-left... etc.
terrain_set_neighbors { instance_id: <TL_id>, right_instance_id: <TR_id>,
bottom_instance_id: <BL_id>, paths_hint: ["Assets/Scenes/Main.unity"] }Repeat for each tile's relevant sides. The Terrain component exposes
topNeighbor / bottomNeighbor / leftNeighbor / rightNeighbor — verify
with component_get.
Agent-sense pairing
unity_open_mcp_component_get(component_typeTerrainorTerrainCollider) reads the raw fields after a mutate (complementary to the structured state returned by the terrain tools).unity_open_mcp_object_get_dataon the TerrainData asset path reads heightmap / alphamap resolutions, layer count, tree counts.unity_senses_screenshot(view:"scene") visually confirms the heightmap / splat / tree changes in the Scene view.
Tool reference
| Tool | Mutating | Lifecycle | Notes |
terrain_create | yes | editor_settle | Allocates TerrainData + Terrain GameObject. Optional .asset save. |
terrain_set_heights | yes | editor_settle | Region write; 513×513 per-call cap; tile large writes. |
terrain_paint_layer | yes | editor_settle | One layer per call; seeds a new TerrainLayer when the index is new (≤8). |
terrain_place_trees | yes | editor_settle | Append instances; seeds a prototype from a prefab when the index is new. |
terrain_set_neighbors | yes | editor_settle | Idempotent; clears a side when no resolver is given. |
Address every terrain host by instance_id > path > name (same model as
gameobject_* / component_*). Every mutating tool requires a non-empty
paths_hint scoped to the host scene path (+ asset paths when assets are
written) — the gate has no whole-project fallback.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

