Inspector Reference
Complete reference for all properties in the TerrainGridSystem inspector. Properties are organized by section as they appear in the Unity Inspector.
Grid Configuration
| Property | Description |
| Terrain | The terrain or root GameObject for the grid. Works with Unity Terrain or any mesh. |
| Topology | Grid shape: Irregular (Voronoi), Box, or Hexagonal. |
| Rows / Columns | Grid dimensions (box and hexagonal topologies). |
| Num Cells | Number of cells (irregular topology only). |
| Territories | Number of territories. Each territory contains one or more cells. Adding territories increases computation time with high cell counts. |
| Regular Hexes | Preserves correct hexagon aspect ratio regardless of grid scaling. |
| Even Layout | Toggles the up/down shift of the first hexagon row. |
| Curvature | Applies curvature to grids with 100 or fewer cells. Triples segment count. |
| Relaxation | Makes Voronoi cells more uniform. Higher values = more iterations = longer generation time. |
| Roughness | Controls how closely the grid follows the terrain surface. Keep low for smooth terrains; increase for flat terrains to reduce vertex count. |
| Seed | Randomization seed for reproducible cell layouts. |
| Flat Cells | When enabled, cells ignore terrain slope and remain horizontal. |
| Max Slope | Maximum terrain slope for cell visibility (1 = no filtering). Reduce to hide cells on steep surfaces. |
| Max Height Difference | Maximum vertex height difference within a cell. Cells exceeding this value are hidden. |
| Min / Max Altitude | Altitude range for cell visibility. Useful for hiding cells under water. |
| Mask | Texture controlling cell visibility via alpha channel (alpha = 0 hides the cell). Hidden cells are excluded from highlighting and pathfinding. |
| Territories Texture | Color texture defining territory shapes. Each unique color creates a territory. Use solid colors only (no gradients). |
Grid Positioning
| Property | Description |
| Mesh Pivot | Local center offset for custom meshes (not Unity Terrain). Adjust if the grid appears off-center. |
| Grid Center / Scale | Position and size of the grid on the terrain surface. Use to show a partial grid around a specific area. |
| Depth Offset | Z-buffer offset for highlight surfaces (Colored Depth Offset) and grid mesh (Mesh Depth Offset). |
| Elevation / Elevation Base | Combined Y-axis displacement above the terrain. |
| Min Elevation Multiplier | Multiplier for the small Y-offset between grid layers. Reduce for very large terrain scales. |
| Camera Offset | Dynamic displacement toward the camera position. |
| Normal Offset | Per-vertex displacement along terrain normals. Expensive — use only when needed. |
Grid Appearance
Performance: If you do not use territories, ensure all territory-related options (Show Territories, Colorize Territories, highlight mode = Territory) are disabled to avoid unnecessary mesh generation.
| Property | Description |
| Show Cells | Toggle cell border visibility. |
| Cell Border Color | Color of cell borders. |
| Show Territories | Toggle territory border visibility. Enables territory mesh generation. |
| Colorize Territories | Fill territories with colors. Also triggers territory mesh generation. |
| Near Clip Fade / FallOff | Fade grid lines when the camera is very close (useful for FPS cameras). |
| Cell Fill Padding | Enlarge or shrink the colored/textured surface area of cells. |
Grid Interaction
| Property | Description |
| Highlight Mode | Interactive selection: None, Cells, or Territories. |
| Overlay Mode | Ground (surfaces appear below scene content) or Overlay (surfaces render on top; faster but less realistic). |
| Respect Other UI | When enabled, grid interaction is suppressed while the pointer is over a uGUI Canvas element. |
Path Finding
| Property | Description |
| Algorithm | Heuristic for A* pathfinding:
- Euclidean — optimal paths based on straight-line distance
- Euclidean Non SQR — faster variant without square root
- Manhattan — grid-aligned paths
- MaxDXDY — more natural-looking paths
- Diagonal Shortcut — favors diagonal movement
|
| Max Search Cost | Maximum total path cost. 0 = unlimited. |
| Use Diagonals | Allow diagonal movement between cells. |
| Diagonals Cost | Cost multiplier for diagonal steps. |
Optimization: The pathfinding algorithm uses a faster variant when the column count is a power of 2 (4, 8, 16, 32, 64, 128, 256...).
Four methods to control path traversal:
| Method | Purpose |
CellSetCanCross | Block or unblock a cell for pathfinding. |
CellSetGroup | Assign a cell to a group. Filter allowed groups in FindPath. |
CellSetCrossCost | Set a custom cost for entering a cell. |
CellSetSideCrossCost | Set a custom cost for a specific cell edge, with optional direction awareness. |
See demo scene 12 for a pathfinding example. See Scripting Support for the full API.
Grid Editor
The Grid Editor section lets you customize individual cells in the Unity Editor.
| Feature | Description |
| Cell Selection | With the Scene View active, click any cell to select it and edit its properties. |
| Texture Painting | Load textures into the array, click the T button to enter paint mode, then click cells to apply textures. |
| Export Settings | Creates a TGS Config component that stores all cell settings for later loading. |
| Reset | Clears all per-cell customizations and restores defaults. |
| Multiple Configurations | Add multiple TGS Config components. Enable one or call LoadConfiguration() to switch. |
Important: Ensure Gizmos are enabled in the Scene View toolbar for cell selection to work.