Godot Version
Godot 4.4
Question
I’m making an inventory system. I have an array of slots, that contain items.
Slot is a class that contains an item (BaseItem) or null.
My logic goes like this: if selected slot contains an item, instantiate a scene that item belongs to. When switching items, QueueFree that instance.
I’ve run into a problem when I added a flashlight with an energy amount. Whenever I switch and instantiate flashlight again, energy amount is at the default level.
I’ve seen people saying that you need to make an instancing method and pass arguments you want scene to instantiate with. Is this really the only option?
Since I can store that data in BaseItem class, seems like there should be a better option, because that would require storing data somewhere else outside the item’s class.