Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Grid

Grid is the base class for plotting a layout of uniformly spaced points and lines.
Read time 7 minutesLast updated 2 days ago

Definition

[RequireComponent(typeof(Transform))]public sealed class Grid : GridLayout

Remarks

The Grid component stores dimensional data of the layout of the grid and provides helper functions to retrieve information about the grid, such as the conversion between the cell location and local space location of items within the grid.
The layout of the Grid component is in the XY plane with the origin of the grid always beginning at (0, 0) and the X and Y coordinates of the grid only as positive values.
Implements the interface GridLayout.

Properties

Property

Description

cellGapThe size of the gap between each cell in the Grid.
cellLayoutCell shape and packing that the grid uses when converting cell positions to local space.
cellSizeThe size of each cell in the Grid.
cellSwizzleCell swizzle order that the grid applies when converting cell positions to local space.

Methods

Method

Description

GetCellCenterLocalGet the logical center coordinate of a grid cell in local space.
GetCellCenterWorldGet the logical center coordinate of a grid cell in world space.

Static Methods

Method

Description

InverseSwizzleDoes the inverse swizzle of the given position for given swizzle order.
SwizzleSwizzles the given position with the given swizzle order.

Inheritance

Inherited Members

Operators

Operator

Description

operator ==Compares two object references to see if they refer to the same object.
boolDetermines whether the object exists.
operator !=Compares if two objects refer to a different object.