Repository navigation
Turns the grid from something that renders into something you can build a game on: coordinates, pathfinding, layouts, and tooling.
Install
https://github.com/tomicz/unity-procedurally-generated-grid.git#v1.1.0
New
- Coordinate conversion.
NodeToWorld/WorldToNodeon the component,GetNodeCenter/TryGetNodeon the plain grid. A position in a spacing gap maps to the node before the gap. - Batched color uploads. Colors set in play mode are uploaded once at the end of the frame.
ApplyColorsflushes early,SetAllNodeColorsresets the grid, andColorsDirtyexposes the state for plain-grid users. - Neighbour queries.
GetNeighborsfills a caller-supplied buffer without allocating and never offers a diagonal that would cut a corner past an obstacle. - A* pathfinding.
GridPathfinderwith a binary-heap open set and reusable buffers.WasVisitedandLastVisitedCountdescribe the explored area. - Saveable layouts.
GridLayoutAsset(Assets > Create > Procedural Grid > Layout) withSaveLayout/LoadLayouton the component. - Custom inspector. Node and vertex counts, memory footprint, a large-grid warning, and buttons for Regenerate, Clear Occupancy, Reset Colors, and layout save/load. Occupied nodes draw as red gizmos.
- Example scripts.
GridPainter(left-drag paints obstacles) andGridPathDemo(right-click sets start and goal, path redraws as you paint), both in the example scene.
Fixed
- Node colors are serialized as a packed byte array. A
Color32[]cost three YAML lines per node and could dwarf the scene file on large grids.
Tests
62 edit-mode tests, up from 26.