Reported By: Nicholas Taveras
September 15, 2023
THE PROBLEM
This week while implementing video settings I ran into an issue with certain settings not saving correctly and UI elements not turning on and off when expected. For example the resolution settings change with buttons on either side of the resolution to change it. When changing it the buttons activate and deactivate properly, but when saving and then loading the game the setting would sometimes show the wrong resolution or disable/enable the wrong buttons. This can be a problem for users because they might not be able to play with their desired settings.
THE SOLUTION
The solution was to set the default states of the UI to also be the default values in the new game data. This is the case because when starting a new game the game saves before it loads so it ends up saving the values of the UI and then loading those values. For example with the brightness slider if its UI default is at 0 and the new game data default is 100, then the game will save first making the game data for brightness 0 and causing the game to load at a brightness of 0. So to fix it I had to change the default slider value for brightness to be 100. Then I made similar changes to the other UI elements for the video settings fixing the problem and causing the game to be able to save and load the video settings correctly.
Did you like this post? Tell us
Leave a comment
Log in with your itch.io account to leave a comment.