4. Bug Fixes and Persistent Data

Last week, I introduced a bug regarding target animation. So this week I added new code, to allow targets to descend immediately when hit, or when the target idle time is over. Using the Ienumerator WaitUntil function and function bools, this bug fix helped increase the pace of the game play, enabling more targets to appear, faster.

Next, I also changed code that saves and loads data. While I previously used BinaryFormatter for data persistence, it’s no longer recommended. So, after a little research, I decided to use Unity’s inbuilt JsonUtility, which works great.

To speed up play-testing, I added some more Debug Menu code, to reset values to Factory Settings, to allow me to test game-play more efficiently. I also refactored the code to play a LevelComplete function when the game ends, or a PlayNextStage function, when the next stage is successfully unlocked.

I have added a quick video below of the Stage Unlock progression, with very short stage timers, and very low Stage Unlock scores. The numbers above the green targets denote different target variants. Gives you an idea how it flows at the moment.

5 x Stage Unlocks are added

An interesting issue I resolved was crashes while I changed a variable, used to index other functions. I found I had forgot to add some additional game objects for my target variables, but the debugger wasn’t flagging these missing files, and failing to show my log-warning. I remember reading somewhere about debugging being difficult on using deeper data structures, like lists or structs used in my StageManager. A potential Unity quirk for me to keep an eye out for.