How to save an Array?
Hi. I am trying to save an Array. It does save one value. But in doing so it resets all the other Int Values in the array back to 0.
What i am trying to achieve is write the current levels score to the array that is save. It does work in the sense that it saves the current level score. But when it does save it, it resets all the other Index to its default which is 0.
Any help would be appreciated. I followed tutorials on youtube about saving multiple actors but somehow what was done there i cannot translate correctly to my setup.
Perhaps due to a lack of understanding.
Are you using a foreach loop to get each array entry in your blueprint to update to the array in the savegame?
Before save to slot, check the source array in your blueprint isn't empty (Length !=0) and if it isn't, make sure the savegame array is cleared (using Clear array function). Then foreach member of the blueprint's array, Add it to the savegame array, then do save to slot. If the source array in your blueprint actually is empty, there's no point to save that array, but you still need to decide whether to clear the saved array so that it matches with the current gamestate.
If you need to be sure that the entries are in the exact order in both arrays, try usng Set Array Element which lets you pass in the index value, and has a Size to Fit tickbox.
Follow this question
Once you sign in you will be able to subscribe for any updates here