I do it most of the time whenever I add a new variable… and I just did it again.
For example, this time:
I have this big structure than contains a lot of my game variables, let’s call it HS (For heavy stats) Every 10 seconds HS is saved to storage and If you close the game, it loads HS at the beginning of the scene.
I recently added a new structure inside HS called Friends which contains details of the NPCS that you can befriend. Basically, Structures with their likes and dislikes.
Yesterday I was messing with the StrFind function for the first time ever.
And I couldn’t make it work! No matter what I tried, I was unable to get results from the HS structure…
Then I created a new variable outside the HS structure to test. And it was working!!! So I thought that StrFind simply couldn’t work with structures, but then I turned the test variable into a structure to test and it still worked.
And then I realised
StrFind wasn’t working because there was no variable to pull results from…
Since I had added a new structure inside my HS structure, and the game was loading older saved data at the beginning, the Friends structure was never actually loaded.
I spent 2 hours of my life on this, and I couldn’t sleep at night because I kept thinking about what was wrong with my code… all because of a stupid mistake that I keep repeating every so often!!!
Anyone else with similar mistakes?
Also, the above situation begs the question… what should I do if I’ve already uploaded a game, but later want to make changes to an existing structure without messing up the player’s saved stats?
Maybe I should check whether the child structure or variable exists first, and then add it to the structure if it doesn’t. But that sounds like a lot of work if you plan to constantly push updates.
