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
- Type: Class
- Namespace: UnityEngine
- Assembly: UnityEngine.GridModule
- Inherits from: GridLayout
[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 |
|---|---|
| cellGap | The size of the gap between each cell in the Grid. |
| cellLayout | Cell shape and packing that the grid uses when converting cell positions to local space. |
| cellSize | The size of each cell in the Grid. |
| cellSwizzle | Cell swizzle order that the grid applies when converting cell positions to local space. |
Methods
Method | Description |
|---|---|
| GetCellCenterLocal | Get the logical center coordinate of a grid cell in local space. |
| GetCellCenterWorld | Get the logical center coordinate of a grid cell in world space. |
Static Methods
Method | Description |
|---|---|
| InverseSwizzle | Does the inverse swizzle of the given position for given swizzle order. |
| Swizzle | Swizzles the given position with the given swizzle order. |
Inheritance
Operators
Operator | Description |
|---|---|
| operator == | Compares two object references to see if they refer to the same object. |
| bool | Determines whether the object exists. |
| operator != | Compares if two objects refer to a different object. |