Better way to approach weapon system data

I made a weapon system and for now I’m saving the basic data (current ammo/ max ammo etc) as structs in a character bp because if weapon gets switched or unequipped it gets destroyed. I know that some people prefer to hide the weapon instead and it wouldn’t be needed to save the data anywhere else, so I wanted to ask, what should be a better way of doing it and why?

In my mind destroying should have slightly better performance but it may be so slight that it doesn’t matter I will have 6-10 unique weapons so it’s not like I would be hiding 200 new actors.

Hi,

Perhaps you can create a ‘Weapons Manager’ actor component that could be added to your player, or even potentially AI enemies.

How I would imagine this Weapon Manager would work is the following:

  • It can track all the weapons the player currently has in their “Inventory”.
  • It would be responsible for spawning/destroying weapons when switching between weapons in the inventory.
  • It would be responsible for tracking weapon specific data such as current ammo/max ammo, and potentially any other information.

Making this a component would allow it to be more universally available to other classes, such as AI; and I believe it is at least worth investigating. I hope this idea is useful, and good luck :slight_smile: