Settings

beginner concepts

Grids 2D · Core Concepts

Inspector Settings

Select the Grids2D GameObject to view all settings in the Inspector. Drag the prefab from Grids2D/Resources/Prefabs into your scene to get started.

Grid Configuration

These parameters define the grid structure: cell count, type, and shape.

ParameterDescription
TopologyGrid shape: Irregular (Voronoi tessellation), Box (rectangular), or Hexagonal.
Columns / RowsNumber of cells horizontally and vertically (Box and Hexagonal topologies). Not available for Irregular.
Num CellsTotal cell count for Irregular topology (Voronoi).
TerritoriesEnables territory generation. A territory groups multiple cells. Specify the number of territories.
CurvatureApplies curvature to grids with 100 or fewer cells. Multiplies segment count by 3.
RelaxationFor Irregular topology. Iterates over the Voronoi algorithm to produce more uniform cell shapes. Higher values = more uniform but slower generation.
Visibility MaskTexture whose alpha channel determines cell visibility. Alpha = 0 hides the cell.
SeedRandomization seed for reproducible cell layouts.
Region TextureColor texture that defines territory shapes. One territory per unique color. Use solid colors without gradients.

Grid Positioning

ParameterDescription
Hide ObjectsQuickly hides or shows the entire grid.
Depth OffsetZ-buffer offset for highlight surfaces and grid mesh. Adjusts draw order relative to other scene objects.
CameraCamera used for interaction calculations. Defaults to the main camera.

Grid Appearance

Controls the visual style of cells and territories. Enabling territory options activates territory mesh generation, so disable them when not needed to save memory and time.

ParameterDescription
Show TerritoriesDisplays or hides territory borders.
Territory Highlight ColorHighlight color when hovering over territories.
Colorize TerritoriesAutomatically assigns random colors to territories.
Territory AlphaTransparency of territory fills.
Outer BordersShows borders of territories not adjacent to other territories (like grid edges).
Internal TerritoriesAllows territories to be contained inside other territories (enclaves).
Canvas TextureAssigns a full-grid texture. When used with CellToggleRegionSurface(), the cell or territory shows the matching portion of this texture. See Demo4_Textures.

Grid Behavior

ParameterDescription
Selection ModeChoose None, Cells, or Territories for pointer interaction.
Overlay ModeGround renders highlights below content on the grid; Overlay renders highlights on top of everything.
Respect Other UIWhen enabled, grid interaction is disabled when the pointer is over a uGUI element (Canvas-based UI only).

PathFinding Settings

ParameterDescription
AlgorithmHeuristic for A* pathfinding: MaxDXDY (natural paths), Manhattan (jaggy), Diagonal Shortcut (favors diagonals), Euclidean (optimal), Euclidean Non SQR (faster), Custom1 (experimental).
Max Search CostMaximum total cost for the returned path.
Max StepsMaximum number of cells in any path.
Use DiagonalsAllow diagonal movement between cells.
Heavy DiagonalsAdd extra cost to diagonal moves, making them less frequent.
Performance tip: For grids with column count that is a power of 2 (8, 16, 32, 64, 256, etc.), the asset uses an optimized variant of the pathfinding algorithm for faster computation.

Cell Grouping

By default, all cells belong to the Universal group (code -1). Assign cells to custom groups using CellSetGroup() for filtered pathfinding and line-of-sight calculations. See the Scripting guide for details.

Grid Editor

The Grid Editor section lets you customize cells at edit time directly in the Scene view.

FeatureDescription
Cell selectionWith the Scene view active, click any cell to select it and modify its properties.
Export SettingsCreates a Grid2DConfig component that stores all cell settings and reloads them on activation.
ResetClears all cell settings and reverts to defaults.
Texture paletteLoad textures into the array and use the "T" button to enable paint mode. Click cells to assign the selected texture.

You can add multiple Grid2DConfig components. Enable the desired one or call LoadConfiguration() to switch configurations at runtime.

Next Steps

For programmatic control, see the Scripting Support page. For common issues, check Troubleshooting.

Was this page helpful?