Hi people. So I’m working on this game where I wanna give the player the choice to choose from a variety of skins for both the knife and the cake. I’ve never worked with save games or inventory systems before, that is why I wanna share with you my approach so you can advise me.
Here is what I’m thinking to do. I’d store all my knife (I’ll use just the knives for example) button images in an array within the main menu widget and create an integer variable within the save game that would would check which knife is selected when the GameInstance is initiated and assigns the correspondent item from the image array.
This sounds confusing but I hope you get what I’m trying to say.
The above picture (psedoscript) demonstrates the retrieval after loading the save game (soft assets need loading, though). This way you wouldn’t need to worry about keeping track of IDs, which can be a royal pain in the neck at times.
Thanks for the new perspective. I don’t know if it’s optimal but I thought I’d choose an integer variable because it would keep track of both the image to display and the knife child BP that’s supposed to spawn in the level.
If I understand, following your method, I’d need 2 variables, one for the image and one for the knife BP. How can connect between them?
Any default values should be in the class itself, variables that can change, should form the rest of the struct above. Default skin does not really belong here for example, it can be tucked away in the class.
over the course of the game, the player will acquire new items and, eventually, we’ll need to save them (you can’t save a spawned actor, so you save the data that defines it):