Hello. I’m making a TPS arena very inspired by the Ratchet & Clank arena sections with over-the-top guns et some melee system.
My issue is that I can’t figure how I can store wich weapons I have unlocked and can replace my current one with an other one that is in my inventory.
I created an Actor class named Weapon that I derived into RangedWeapon and MeleeWeapon, then I create BP classes from these C++ classes to be my actual weapons
.
I try to create an Array of subclasses of Weapon in my character in which I store the unlocked weapons but my array does contain class references, not object references. Which mean I’m forced to do delete my current weapon then SpawnActorOfClass each time I want to equip another weapon wich mean I lost all the data of the previous weapon (for example remaining ammo).
If I put the property Instanceed in my array of subclasses Weapon, now I have object references but I can’t fill my array with my weapons in the editor since no weapon is instanced while not in Play mode.
I really wonder how I can make extensible, modular and maintenable inventory system, if someone can give hint I would really appreciate it. On Youtube I only find very bad or short designed (in my opinion) responses and almost no C++ neither.
Thanks for your help!