It’s a great framework for working with all kinds of grids. Redmond Urbino, Disney Mobile

Grids for Unity is a library that makes it easy to implement games that use grids.

30 Games in 30 Days

Grids is a rich library that is easy to extend if you need to. In November 2013 we made 30 games with Unity Game Engine and Grids to show the power of our library. The video below shows these games. See 30 Games in 30 Days to find out more.

Examples

To help you get started with Grids, we made more than 70 examples, including several games. The video below shows the examples that ship with grids. You can check out the other examples here.

A truly wonderful plugin. Pietro Polsinelli, Genio and People In Love developer.


Features

Grids

Grids are data structures, similar to 2D arrays. They can contain any data type, and can be constructed in a variety of pre-defined or custom shapes. The following grids are provided:

  • Rect and Diamond grids
  • Hex grids
  • Tri grids
  • Rhomb grids
  • Cairo pentagon grids
  • Several types of polar grids
  • Line and point set grids
  • Generic spliced grids
  • And compound grids: layered grids and nested grids

See the Grid Index for the full list.

You can also use grid algorithms on your own grids. For Rect, Diamond, and Hex grids there are methods to get the associated vertex and edge grids.

GridTypes21

Cells

Cells are the elements of the grid. You can use the built-in cells, or make your own. Cells can be sprites, meshes, GUI widgets, or even raw data.

Grid Points

Cells are accessed with grid points or integer vectors. Grid points can be added, scaled, and transformed similar to normal vectors. Grids support queries on points to find neighbors. Grid points support colorings, making it easy to implement many algorithms. The library has algorithms for doing geometric calculations using these points, such as defining lines are testing polygons.

Maps

Maps do the conversion from world space to grid space. Maps can be transformed independently of the grid. Built-in transformations make it easy to align grids in rectangles (such as the screen).

You can also define your own maps, making it possible to have grids on interesting shapes.

GameImage_680x340

Algorithms

The library contains many algorithms:

  • A* path finding
  • Range and cost algorithms
  • Connection algorithms (used in match games), such as finding connected lines or connected sets
  • Algorithms to process neighborhoods of cells
  • Algorithms for transforming sets of points
  • Geometry and other grid mathematics

Pathfinding Hex 460x230

You can work with grids in code, or do basic configuration in the editor.

If you are familiar with Amit Patel’s excellent guide on Hexagonal Grids, you may find this breakdown of features useful. It shows how Grids supports all the features in that article:

Gamelogic’s Grids and Amit Patel’s Guide for Hexagon Grids


30-day trial