Redirect to the Docs main page.Docs

Grids

Learning the Grids

Understand the core concepts of grids and how they are used in Ultimate Grid Inventory.

Grids are the foundation of Ultimate Grid Inventory, allowing structured item placement and interaction. Understanding how grids work is key to effectively using the system.

Understanding Grids

A GridTable is an in-memory structure that manages item placement, while an ItemGrid2D provides a visual representation. Multiple UI grids can reference the same GridTable, ensuring consistent updates across all views.

Grid Components

GridTable

The GridTable is the core data structure that holds item positions. Unlike MonoBehaviour, it exists purely in memory, managing item data independently from the UI. Every grid in the system operates on a GridTable, making it the primary structure for handling inventory logic.

ItemGrid2D (extends AbstractGrid)

The ItemGrid2D component is the UI representation of a GridTable. It acts as a visual interface, allowing players to interact with items. Since multiple ItemGrid2D instances can be linked to the same GridTable, changes in one UI update all others in real-time.

Creating an ItemGrid2D

To create a new ItemGrid2D:

  1. Right-click in the Unity Hierarchy.
  2. Navigate to Ultimate Grid Inventory > Item Grid.
  3. Place it in the scene and configure its properties.

ContainerGrids

ContainerGrids are specialized grids used for Container Items. These grids allow items that can hold other items (like backpacks or chests) to have their own storage space.

To set up a Container Grid:

  • Create a ContainerGrids instance. Add some ItemGrid2D in it then save as prefab
  • Assign it to the Container Grids field in an ItemDataSo scriptable object.

For detailed steps, refer to Creating Grids for Your Container Item.

Summary

  • GridTable stores item positions and logic in memory.
  • ItemGrid2D provides a UI for interacting with grids.
  • ContainerGrids allow items to have their own internal storage.

Understanding these components will help you efficiently implement grid-based inventory management in your project.

On this page