Hexagonal Map Editor

A hexagonal map editor implemented in Unity

StatusComplete Linkgithub.com

I developed this hexagonal map editor in Unity 6 partly as an exploration into how hexagonal maps work in games like the modern Civilization titles, but also to become more familiar with authoring custom tools in Unity.

It consists of the following:

  • A hexagonal grid with cells in flat-top orientation using an axial coordinate system
  • A custom shader for drawing the cells, including properties to adjust grid size, cell size, and colours for each state (normal, hovered, selected)
  • HexagonalMapData: A ScriptableObject implementation to persist cell data (which includes asset references for prefabs to spawn in each cell)
  • HexagonalMap: A MonoBehaviour implementation that handles the grid settings, updates to the shader properties, and updates to the cell data
  • HexagonalMapEditor: A CustomEditor implementation for HexagonalMap that exposes the grid settings via the inspector and draws previews of content placed in the cells
  • HexagonalMapEditorWindow: An EditorWindow implementation using the Addressables package for grouping, listing, and selecting prefabs to place in the currently selected cell

The source code is available at github.com/Riari/unity-hex-map-editor .

Here’s a video of the editor in action:


Map editor window
Map settings
Shader settings
Scene view
Screenshots

The tile assets I used in this project are from itch.io/dice-lands-hexagon-tile-assets .