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
CameraThe camera used for calculations such as highlighting and fade. Main camera is used by default.
TerrainThe terrain or root GameObject for the grid. Works with Unity Terrain or any mesh.
Multiple ObjectsSpans the grid across multiple terrain tiles or mesh objects. TGS automatically locates all neighbours and adjusts the grid size.
Objects Name PrefixOnly include terrain game objects whose name starts with this prefix (case insensitive). Visible when Multiple Objects is enabled.
Objects Layer MaskOnly include terrain game objects that match this layer mask. Visible when Multiple Objects is enabled.
Search GlobalSearch for potential terrain objects in the entire scene hierarchy. Visible when Multiple Objects is enabled.
Heightmap Width / HeightDimensions for custom heightmap when using mesh-based terrain that supports it.
TopologyGrid shape: Irregular (Voronoi), Box, or Hexagonal.
Bake Voronoi / Clear Baked DataSerializes or clears the Voronoi cell layout so it persists without regeneration (irregular topology only).
Columns / RowsGrid dimensions (box and hexagonal topologies).
Cells (aprox.)Approximate number of cells (irregular topology only).
TerritoriesNumber of territories. Each territory contains one or more cells.
Territories TextureColor texture defining territory shapes. Each unique color creates a territory. Use solid colors only.
Neutral ColorColor to be ignored when using a territories texture.
Hide Neutral CellsCells belonging to neutral (ignored) territories will be invisible.
Initial Cell MethodHow the initial cell for each territory is selected: Random or UserDefined.
AsymmetryControls the distribution of cells among territories. Higher values produce territories with different sizes.
OrganicProduces irregular, organic-looking territory borders.
Max IterationsMaximum number of iterations for territory generation. 0 = no limit.
Max RangeMaximum distance in cell units from the origin cell when growing a territory.
Regular HexesPreserves correct hexagon aspect ratio regardless of grid scaling (hexagonal topology).
Hex WidthWidth of each hexagon when Regular Hexes is enabled.
Adjust Canvas SizeAutomatically adjusts the canvas to fit the regular hexagons.
Pointy TopSwitches hexagon orientation between flat-top and pointy-top (hexagonal topology).
Even LayoutToggles the up/down shift of the first hexagon row.
CurvatureApplies curvature to grids with 100 or fewer cells. Triples segment count.
Corner JitterAdds random displacement to cell corners for a more organic look (box and hexagonal topologies).
RelaxationMakes Voronoi cells more uniform. Higher values = more iterations (irregular topology only).
SeedRandomization seed for reproducible cell layouts.
RoughnessControls how closely the grid follows the terrain surface.
Flat CellsWhen enabled, cells ignore terrain slope and remain horizontal.
MaskTexture controlling flat cell rendering via alpha channel (0 = cell adapts to terrain as usual). Only available when Flat Cells is enabled.
Max SlopeMaximum terrain slope for cell visibility (0-1). Cells on steeper surfaces are hidden.
Max Height DifferenceMaximum vertex height difference within a cell. Cells exceeding this value are hidden. 0 = not used.
Minimum AltitudeCells below this altitude are hidden. Useful for hiding cells under water. 0 = not used.
Maximum AltitudeCells above this altitude are hidden. 0 = not used.
Clamp VerticesWhen using min/max altitude, clamp cell vertices to the altitude limit instead of hiding the entire cell.
Hide Isolated CellsCells with no visible neighbours will be hidden automatically.

Rendering Options

Controls how the grid mesh is generated and rendered.

PropertyDescription
Disable Mesh GenerationThe grid system can be used through API but won't render any visual grid. Useful for logic-only grids.
MaskTexture controlling cell visibility via alpha channel (alpha = 0 hides the cell). Hidden cells are excluded from highlighting and pathfinding.
Use ScaleRespects grid offset and scale parameters when applying the mask texture.
Inside CountMinimum number of vertices that must fall inside the mask to consider the entire cell visible.
Use Geometry ShadersUse geometry shaders if the platform supports them. Not supported on VR or Metal.
Transparent BackgroundRenders the grid without an opaque background, suitable for 2D or overlay use cases.
Sorting OrderRenderer sorting order when Transparent Background is enabled.
Use Stencil BufferUses the stencil buffer to avoid overdraw and ensure correct rendering order. Disable if it conflicts with other stencil-based renderers.
Canvas TextureOptional background texture revealed when using the texture methods of cells or territories.
Animation Sorting OrderSorting order for animation effects such as fade-out grid elements.
Animation Sorting LayerSorting layer for animation effects.

Grid Positioning

PropertyDescription
Toggle Terrain / Toggle GridButtons to quickly show/hide the terrain or the grid in the editor for easier visualization.
Mesh PivotLocal center offset for custom meshes (not Unity Terrain). Adjust if the grid appears off-center.
Grid CenterPosition of the grid center in local space. Use to show a partial grid around a specific area.
Grid ScaleSize of the grid on the terrain surface in local space.
Match Cell SizeSpecify a desired cell size and click Update Cell Size to automatically adjust the grid scale.
Bottom Left Corner / SizeShows the current world-space position and size of the grid. You can set new values and click Set Position & Size.
Mesh Depth OffsetZ-buffer offset for the grid mesh lines.
Cells Depth OffsetZ-buffer offset for cell highlight surfaces.
Territories Depth OffsetZ-buffer offset for territory surfaces.
ElevationY-axis displacement above the terrain surface.
Elevation BaseBase elevation added to the Elevation value.
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.

Territories Appearance

Controls the visual appearance of territory borders and fills.

Performance: If you do not use territories, ensure all territory-related options (Show Frontiers, Colorize Territories, highlight mode = Territory) are disabled to avoid unnecessary mesh generation.
PropertyDescription
Show FrontiersToggle territory border visibility. Enables territory mesh generation.
Frontier ColorColor of the territory borders.
Disputed FrontierColor for shared borders between two territories.
Custom ThicknessEnable to draw territory borders with a configurable thick line.
ThicknessBorder line thickness when Custom Thickness is enabled.
Miter JoinsReuses vertices at joints to produce continuous borders without gaps or overlaps.
Outer BordersShow territory borders on the outer edges of the grid.
Show Interior BordersDraw an additional inner border line inside each territory.
Interior Border ThicknessThickness of the interior border.
Interior Border PaddingDistance between the interior border and the territory edge.
Show On TopRender interior borders on top of regular territory borders.
Include EnclavesAdds additional interior borders around regions belonging to other territories (enclaves).
Colorize TerritoriesFill territories with colors. Also triggers territory mesh generation.
AlphaOpacity of the territory fill color.
Color SchemeAutomatic color assignment: Gradient, Cool, Warm, or UserDefined.
Color SeedRandom seed for territory color assignment.
Fill ColorsArray of custom colors when Color Scheme is set to UserDefined.
Internal TerritoriesAllows territories to be fully contained inside other territories.
Highlight ColorColor used when the pointer hovers over a territory.

Cells Appearance

Cells appearance with near clip fade

Controls the visual appearance of cells, highlights, and fade effects.

PropertyDescription
Show CellsToggle cell border visibility.
Border ColorColor of cell borders.
Custom ThicknessEnable to draw cell borders with a configurable thick line.
ThicknessCell border line thickness when Custom Thickness is enabled.
Texture ModeChoose how textures are rendered inside cells: Cell (inside the cell shape) or Floating (a quad over the cell area). Only available without terrain, for box/hexagonal topology.
Background ModeHow the floating texture background is rendered (Floating mode only).
Scale / OffsetScale and offset for floating textures (Floating mode only).
Fill PaddingEnlarge or shrink the colored/textured surface area of cells.
Alpha ClippingEnables alpha clipping so transparent pixels are discarded instead of blended.
ThresholdAlpha test threshold value when Alpha Clipping is enabled.
Highlight ColorColor used when the pointer hovers over a cell.
Use Cell ColorUse the cell's current fill color as the highlight color instead.
Border Size / Border ColorAdd a highlight border effect to the highlighted cell (box topology only).
Highlight FadeMin/max range for the highlight fade animation.
Highlight SpeedSpeed of the highlight fade animation.
Highlight EffectVisual effect for highlighting: Default, DualColors, TextureAdditive, TextureMultiply, TextureColor, TextureScale, or None.
Scale RangeMin/max scale for the TextureScale highlight effect.
Alternate ColorsSecondary highlight colors for cells and territories when using DualColors effect.
Highlight MaskOptional mask texture for the highlight effect.
Near Clip FadeFades out grid lines when the camera is very close (useful for FPS cameras).
Far Distance FadeFades out grid lines when the camera is far away.
Circular FadeFades out grid lines based on distance from a target Transform. Useful for showing the grid only around the player.
Distance / FallOffDistance threshold and transition smoothness for all fade modes.

Grid Interaction

PropertyDescription
Selection ModeInteractive selection: None, Cells, or Territories.
Include Invisible CellsAllow invisible cells to be highlighted and selected.
Minimum DistanceMinimum distance from the camera for a cell or territory to be selectable. Useful in first-person view to prevent selecting cells under the character.
Highlight While DragAllows highlighting while dragging the mouse over the grid during a drag operation not started on the grid.
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.
Blocking MaskLayer mask used to block grid interaction when other objects block the raycast.

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.
Max StepsMaximum number of cells to evaluate during pathfinding. Limits computation for large grids.
Include Invisible CellsAllow pathfinding to traverse invisible cells.
Use DiagonalsAllow diagonal movement between cells (box topology only).
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
Export Grid ConfigCreates a TGS Config component that stores all cell settings for later loading.
Export Grid MeshCreates a copy of each territory grid mesh as a new game object. Does not modify the current grid.
ResetClears all per-cell customizations and restores defaults.
Display Cell InfoShows cell information in Scene View: Nothing, Cell Index, Cell Coordinates, or Path Finding Cross Cost.
Display Territory InfoShows territory information in Scene View: Nothing or Territory Index.
Enable EditorEnables cell editing in the Scene View. Click a cell to select it (hold Control or Shift for multi-select).
VisibleToggle visibility of the selected cell.
Visible AlwaysThis cell will ignore visibility rules and remain visible regardless of other settings.
Can CrossWhether this cell can be traversed by pathfinding.
Cross CostCost to cross this cell or individual sides. You can set per-side costs for fine-grained control.
Territory IndexAssign the selected cell to a specific territory.
TagAn integer tag for custom cell identification.
Custom Cell DataKey-value attribute pairs that can be attached to individual cells for game-specific data.
Color / TextureAssign a fill color and texture to the selected cell. Textures support scale and offset.
Texture PaintingLoad textures into the array, click the T button to enter paint mode, then click cells to apply textures.
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?