Scripting API

GridLayout

class in UnityEngine · UnityEngine.GridModule · inherits from Behaviour

15 of 15 of Unity's membersUnity's documentation
In Tassix

A layout of cells: their size and gap, and how cell coordinates map to local space (rectangles, hexagons or isometric diamonds, with the axes swizzled). Grids and tilemaps share it; a tilemap uses its parent grid's layout.

Properties 4

Vector3 cellGap { get; }
CellLayout cellLayout { get; }
Vector3 cellSize { get; }
CellSwizzle cellSwizzle { get; }

Methods 12

Vector3 CellToLocal(Vector3Int cellPosition)

A cell's corner (its origin) in local space.

Vector3 CellToLocalInterpolated(Vector3 cellPosition)

A (fractional) cell position in local space.

Vector3 CellToWorld(Vector3Int cellPosition)
Bounds GetBoundsLocal(Vector3Int cellPosition)
Bounds GetBoundsLocal(Vector3 origin, Vector3 size)
Vector3 GetCellCenterLocal(Vector3Int position)
Vector3 GetCellCenterWorld(Vector3Int position)
Vector3 GetLayoutCellCenter()

Where a cell's center is relative to its origin, in cells.

Vector3Int LocalToCell(Vector3 localPosition)

The cell containing a local position.

Vector3 LocalToCellInterpolated(Vector3 localPosition)

A local position in (fractional) cell coordinates.

Vector3 LocalToWorld(Vector3 localPosition)
Vector3Int WorldToCell(Vector3 worldPosition)
Vector3 WorldToLocal(Vector3 worldPosition)