Settings
beginner conceptsGrids 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.
| Parameter | Description |
|---|---|
| Topology | Grid shape: Irregular (Voronoi tessellation), Box (rectangular), or Hexagonal. |
| Columns / Rows | Number of cells horizontally and vertically (Box and Hexagonal topologies). Not available for Irregular. |
| Num Cells | Total cell count for Irregular topology (Voronoi). |
| Territories | Enables territory generation. A territory groups multiple cells. Specify the number of territories. |
| Curvature | Applies curvature to grids with 100 or fewer cells. Multiplies segment count by 3. |
| Relaxation | For Irregular topology. Iterates over the Voronoi algorithm to produce more uniform cell shapes. Higher values = more uniform but slower generation. |
| Visibility Mask | Texture whose alpha channel determines cell visibility. Alpha = 0 hides the cell. |
| Seed | Randomization seed for reproducible cell layouts. |
| Region Texture | Color texture that defines territory shapes. One territory per unique color. Use solid colors without gradients. |
Grid Positioning
| Parameter | Description |
|---|---|
| Hide Objects | Quickly hides or shows the entire grid. |
| Depth Offset | Z-buffer offset for highlight surfaces and grid mesh. Adjusts draw order relative to other scene objects. |
| Camera | Camera 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.
| Parameter | Description |
|---|---|
| Show Territories | Displays or hides territory borders. |
| Territory Highlight Color | Highlight color when hovering over territories. |
| Colorize Territories | Automatically assigns random colors to territories. |
| Territory Alpha | Transparency of territory fills. |
| Outer Borders | Shows borders of territories not adjacent to other territories (like grid edges). |
| Internal Territories | Allows territories to be contained inside other territories (enclaves). |
| Canvas Texture | Assigns a full-grid texture. When used with CellToggleRegionSurface(), the cell or territory shows the matching portion of this texture. See Demo4_Textures. |
Grid Behavior
| Parameter | Description |
|---|---|
| Selection Mode | Choose None, Cells, or Territories for pointer interaction. |
| Overlay Mode | Ground renders highlights below content on the grid; Overlay renders highlights on top of everything. |
| Respect Other UI | When enabled, grid interaction is disabled when the pointer is over a uGUI element (Canvas-based UI only). |
PathFinding Settings
| Parameter | Description |
|---|---|
| Algorithm | Heuristic for A* pathfinding: MaxDXDY (natural paths), Manhattan (jaggy), Diagonal Shortcut (favors diagonals), Euclidean (optimal), Euclidean Non SQR (faster), Custom1 (experimental). |
| Max Search Cost | Maximum total cost for the returned path. |
| Max Steps | Maximum number of cells in any path. |
| Use Diagonals | Allow diagonal movement between cells. |
| Heavy Diagonals | Add extra cost to diagonal moves, making them less frequent. |
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.
| Feature | Description |
|---|---|
| Cell selection | With the Scene view active, click any cell to select it and modify its properties. |
| Export Settings | Creates a Grid2DConfig component that stores all cell settings and reloads them on activation. |
| Reset | Clears all cell settings and reverts to defaults. |
| Texture palette | Load 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.
Suggest an improvement
Help us improve this documentation page.