Problems with inventory/quickbar system

Can anyone help me with my inventory system? I wanna create a quickbar where I can switch weapons and when I pick up a weapon it automaticly goes into the next available slot. and it works when I change my global variables by myself but I don’t know how to let it react when I pick up a weapon. I hope my explenation is a little bit clear…




I have a hotbar example on my itchio page. It is not an example of “the way to do it”, but it might give you some ideas for modification to your own project. Like using the slot objects themselves to store the information of the object they’re holding. If you look at it you can ignore the calls to a scene variable to check if certain children existed. It relies on a loophole of not predeclaring every single variable in the world and anyway I only used it for modifying quantity and variables to the slot.

Hotbar Example by lucky-j (itch.io)

Thanks, I will try to get it working this way.

Well I think you can do improvements based on your nice system but it might give you some ideas to get started.