Godot Version
4.6
Question
Helloooo :3
Ive been at this for about a week and still cant figure it out :,D ive followed multiple tutorials, mainly MakerTech’s “how to make an inventory” series, and yet I still cant seem to figure out how. I wanted a sort of inventory where you can drag-and-drop items onto areas where things would work (think habromania if you know what that is, or those old point-and-click flash games), and im able to interact with objects (script at the bottom), but i cant seem to be able to add it to my inventory.
tldr: how do i add objects i interact with to my inventory? (3D if that helps)
Collectable script:
extends StaticBody3D
func interact():
print("interacted")
queue_free()
Inventories are a complex web of systems, you could try to represent your items as Resources in the menu; in 3D when an item is picked up the 3D representation is deleted and the Resource representation is added to the menu.
2 Likes
how would one do that (im sorry im really new to godot :,D)
Depends heavily on your project. If you are unsure how to extend resources you can create a script like so
extends Resource
class_name InventoryItem
@export var item_name: String
@export var item_image: Texture2D
In the filesystem you will be able to create new InventoryItem resources once this script is saved anywhere, those .tres resources store a little bit of data about each type of item, add more @export variables depending on what you need from your items and extend InventoryItem if some items are more complex than others.
1 Like
ooooooh, i think i did that in the tutorial!! 
thank you!! ^^ im gonna see if it, yk, works