Hi! My savesystem saves a custom struct into an array, for each user save. It works fine, BUT the first time I run the game, that decides how many items that array can take. If I play the game and only save 3 times, subsequent launches can only save to those 3 array indexes. If I spam save and push 20 items into the savegame array, I can save to those 20 indexes on subsequent runs. Why does it behave this way? I have searched, and I can find no description that this is how it should behave.
You mean the âcreate new save game objectâ? it gets created if it doesnât exists, but nothing more, since I donât have anything to load from it. But the code below will reference it and stick data into it later during saving. If Iâm mistaken, how should it be done?
I used INSERT because if I cleared a slot mid-array, then saved to it - it would be not found, and with ADD, that new save would appear last in the array. INSERT used the knowledge of which display index is has in the UI, and sticks it in there. WAIT!? you mean if I used INSERT at array index:(last index +1) it wont do anything? omg, that might be it!
SET would work, if I would keep empty slots in the array. Hmm, which I donât. Thatâs an option!
But it really was INSERT that broke the code. Or rather my addition of an Autosave, causing new slots to appear at +2 of my arrayâs length. INSERT at +1 did work, but not +2⌠That explains why it worked the first run, but not on subsequent launches, since that first quit made an autosave . Hmm I could could chose either option now, one that clears away empty slots, and one that doesnât⌠it will be donw to UX
Thank YOU!!! This was quite the blocker to my system