Inventory system and workflow to pass and inherit data

Would this be reliable system for 3D Survival Game and inventory system ?
Fixed 30 slots in 6 columns , Grid Container

  • store item specifics in Resources as ItemData
  • UI be connected to Player, Inventory Manager , Resource( ItemData)
  • Inventory Manager be responsible for for_loop in UI to updating Slots, when occupied use next in Array - updating Button_normal to Resource.icon, if empty change Button_Normal to null,
  • Player be responsible for Raycast and detecting Scene in 3D world / can pickup . ( should it communicate with Inventory Manager to update this - use signal maybe ? )

Sounds fine. Just rename Inventory Manager to Inventory

This is almost exactly how I’ve built my Inventory system, except I’m using a few extra layers. My InventoryDialog (the UI window for the inventory) contains a custom ItemGrid class, which is just a custom GridContainer class. It creates and manages ItemSlot panels - each of them represents an item from the player’s inventory. The workflow looks like this:

  1. Player presses the button to open Inventory, which sends a signal to InventoryDialog that contains the player’s Inventory resource as a parameter called player_inventory.
  2. The InventoryDialog window shows itself and calls display(player_inventory) on its ItemGrid
  3. The ItemGrid receives player_inventory, loops through its contents, and creates and adds a new ItemSlot child for each item in the inventory. The itemslot contains the name, quantity, and sprite for the item.

It takes a while to figure out how to hook everything together, but it seems to work pretty well so far!

1 Like