Inventory and UI¶
The package includes a hotbar, inventory grid, drag and drop slots, crafting UI, and save menu UI.
Main Scripts¶
Assets/PixitGames/BlockWorld/Scripts/Inventory.cs
Assets/PixitGames/BlockWorld/Scripts/UI/InventoryUI.cs
Assets/PixitGames/BlockWorld/Scripts/UI/InventorySlotUI.cs
Assets/PixitGames/BlockWorld/Scripts/UI/CraftingGridUI.cs
Assets/PixitGames/BlockWorld/Scripts/UI/DemoSaveMenu.cs
Inventory¶
Inventory owns:
- Hotbar size
- Main inventory size
- Slot array
- Selected hotbar index
- Add, consume, swap, and notify logic
Slots can contain:
- BlockData
- ToolData
- ItemData
Inventory UI¶
InventoryUI wires hotbar and inventory slot UI components to slot indices.
It also:
- Opens and closes inventory panels
- Opens crafting station UI
- Disables player control while inventory is open
- Unlocks cursor while UI is open
Slot UI¶
InventorySlotUI supports:
- Icon display
- Count display
- Hotbar selection
- Drag source
- Drop target
- Slot swapping
Save Menu¶
DemoSaveMenu controls:
- New game
- Load game
- Save game
- Delete save
- Quit
- Cursor unlock while menu is open
- Player component disabling while menu is open
By default the save menu toggles with M.