Download

What to use as Inventory Items? Shooter Survival Game Inventory Problem.

So ive been watching a few tutorials and Guides here and there for inventory, but one thing i notice is when a weapon with ammo is put back into the inventory it loses active data.

This is due to array of Struct, since they have static variables and have no parent child relations its hard to store item specific data like ammo and such.

So i was wondering what is the best object to use to store data for each inventory item with active data, so weapons keep their attachments and ammo in clip when throwing them in the inventory?

Actors stay persistent in the world so using them would seem to be not efficient, and Data assets don’t seem like the way to go but could be wrong with them.

When the weapon is put back into the inventory, do you mean it’s destroyed and then spawned once you take it out?

If that’s the case, then one way to do it, would be to just make the weapon invisible ( weapon -> rendering -> visible/hidden in game ).

You can also try to save data about the weapon in the character that is using the weapon, like set a float and set it whenever the ammo in the weapon changes, same for clips. As for the attachments, you can assign to every single one of them a number defining it’s type ( 1 = laser sight, 2 = grip etc. ) as well as the amount of attachments and then use a switch that would run “amount of attachments” times and spawn the specified attachment in a socket in the weapon.

Assuming I understood correctly.