X Tutup

Inspector Reference

intermediate concepts

Terrain Grid System 2 · Core Concepts

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

Grid Configuration inspector
PropertyDescription
TerrainThe terrain or root GameObject for the grid. Works with Unity Terrain or any mesh.
TopologyGrid shape: Irregular (Voronoi), Box, or Hexagonal.
Rows / ColumnsGrid dimensions (box and hexagonal topologies).
Num CellsNumber of cells (irregular topology only).
TerritoriesNumber of territories. Each territory contains one or more cells. Adding territories increases computation time with high cell counts.
Regular HexesPreserves correct hexagon aspect ratio regardless of grid scaling.
Even LayoutToggles the up/down shift of the first hexagon row.
CurvatureApplies curvature to grids with 100 or fewer cells. Triples segment count.
RelaxationMakes Voronoi cells more uniform. Higher values = more iterations = longer generation time.
RoughnessControls how closely the grid follows the terrain surface. Keep low for smooth terrains; increase for flat terrains to reduce vertex count.
SeedRandomization seed for reproducible cell layouts.
Flat CellsWhen enabled, cells ignore terrain slope and remain horizontal.
Max SlopeMaximum terrain slope for cell visibility (1 = no filtering). Reduce to hide cells on steep surfaces.
Max Height DifferenceMaximum vertex height difference within a cell. Cells exceeding this value are hidden.
Min / Max AltitudeAltitude range for cell visibility. Useful for hiding cells under water.
MaskTexture controlling cell visibility via alpha channel (alpha = 0 hides the cell). Hidden cells are excluded from highlighting and pathfinding.
Territories TextureColor texture defining territory shapes. Each unique color creates a territory. Use solid colors only (no gradients).

Grid Positioning

PropertyDescription
Mesh PivotLocal center offset for custom meshes (not Unity Terrain). Adjust if the grid appears off-center.
Grid Center / ScalePosition and size of the grid on the terrain surface. Use to show a partial grid around a specific area.
Depth OffsetZ-buffer offset for highlight surfaces (Colored Depth Offset) and grid mesh (Mesh Depth Offset).
Elevation / Elevation BaseCombined Y-axis displacement above the terrain.
Min Elevation MultiplierMultiplier for the small Y-offset between grid layers. Reduce for very large terrain scales.
Camera OffsetDynamic displacement toward the camera position.
Normal OffsetPer-vertex displacement along terrain normals. Expensive — use only when needed.

Grid Appearance

Grid appearance with near clip fade
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.
PropertyDescription
Show CellsToggle cell border visibility.
Cell Border ColorColor of cell borders.
Show TerritoriesToggle territory border visibility. Enables territory mesh generation.
Colorize TerritoriesFill territories with colors. Also triggers territory mesh generation.
Near Clip Fade / FallOffFade grid lines when the camera is very close (useful for FPS cameras).
Cell Fill PaddingEnlarge or shrink the colored/textured surface area of cells.

Grid Interaction

PropertyDescription
Highlight ModeInteractive selection: None, Cells, or Territories.
Overlay ModeGround (surfaces appear below scene content) or Overlay (surfaces render on top; faster but less realistic).
Respect Other UIWhen enabled, grid interaction is suppressed while the pointer is over a uGUI Canvas element.

Path Finding

Pathfinding diagonal modes
PropertyDescription
AlgorithmHeuristic 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 CostMaximum total path cost. 0 = unlimited.
Use DiagonalsAllow diagonal movement between cells.
Diagonals CostCost 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:

MethodPurpose
CellSetCanCrossBlock or unblock a cell for pathfinding.
CellSetGroupAssign a cell to a group. Filter allowed groups in FindPath.
CellSetCrossCostSet a custom cost for entering a cell.
CellSetSideCrossCostSet 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

Grid Editor inspector

The Grid Editor section lets you customize individual cells in the Unity Editor.

FeatureDescription
Cell SelectionWith the Scene View active, click any cell to select it and edit its properties.
Texture PaintingLoad textures into the array, click the T button to enter paint mode, then click cells to apply textures.
Export SettingsCreates a TGS Config component that stores all cell settings for later loading.
ResetClears all per-cell customizations and restores defaults.
Multiple ConfigurationsAdd 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.
Was this page helpful?
X Tutup