Hi, I’m creating an inventory system, and I’m struggling to think of a way to save weapon customizations while the weapon isn’t equipped, or is dropped and picked back up, or sold and bought back, etc…
For example if I picked up a barebones weapon, no attachments or camos or anything, and then from my inventory widget I choose to customize the weapon, and equipped a sight (which could have another layer of customizations, such as reticle shape and color) somewhere along the top rail, and a grip somewhere along the bottom rail, a torch at the front end of the bottom rail, changed its camo, etc… while it’s either in my backpack (not just swapping between 2 or 3 weapons on the fly), in my hotbar, or in my hand. I then move it around in my inventory to another slot, such as from my backpack to my hotbar, or from my backpack to a shopkeeper/other player for trade, or drop it on the floor, then the next time it’s picked up and looked at in the inventory or equipped it should have the same customizations as I left it with.
Basically how do I keep a memory of my weapons custom variables that can be changed at runtime while the item isn’t spawned in the world, and is just referenced by a slot in the inventory, and then remember any changes that were or weren’t made when it is next spawned, keeping the ammo in the clip, camo, attachments and their locations and customizations, etc…?
What would be the best way to go about this, keeping it optimized and not spawning an object for each inventory slot that stores the variables (that’s the only way I’ve thought of, but I don’t even think that would work (especially through different levels), and I definitely don’t think it would be optimized having 100’s of objects for each inventory in the world!), bearing in mind it won’t just be weapons that are customizable, other item types could have their own variables that can be changed
Sorry if my explanation made that more complicated than it had to be