Load/Save System
This Module adds two new Actions that can be used with loading a Saved Game.
Action Name
Description
Current Profile from Variable
Allows the setting of the Player Profile from a Global Variable
Delete All Profiles
Deletes all current Player profiles
These Actions can only be used with Game Creator Version 1.1.6 or Higher.
There are also two new scripts, one for uGUI text and one forTMP text. The scripts are called DropDownSaves and DropDownSavesTMP respectively. They are atteched to the UI Dropdown with the DropDown Elements added to the Save Slot, the Text Label added to the Label Slot, and the name of a Global Number Variable added to the Target Variable slot (in our example this is titled Load-Slot).
After this has been added to the DropDown element, we have added the On Value Change by dragging in the Dropdown Element, and selecting the dropdown_indexchanged method.
The above points are only of use for those wishing to build their own Load/Saved system
The DropDown element should now works as designed. Any Saved Games will be displayed in the list in the order of most recent at the top, and on selection, the name is placed in the Label and the corresponding Profile number for this saved game is placed in the Load-Slot Varaible.
When the Load Button is clicked, the profile is set to the selected one, and the game is loaded from this profile.
There are two other points to consider. Firstly, when saving a game, you should configure your save Actions as shown in the example.
We have added a Global Number Variable called Save-Slots. We use this to keep track of saved games as to not overwrite saved games from the last play session. As shown above, before you save a game, add 1 to the Save-Slots variable, then set the current Profile from this variable using the new Action that is included with UI Components. Finally, save the game using the current profile.
The second point is how to clear or delete saved games (there are a maximum of 99 profile slots). You will note that we have added a GC Toggle checkbox to the DropDown panel.
When this is checked, the toggle will change a Global Bool Variable. We have called this Clear-Save-Slots.
Then we add the following GC Condition to check this Variable and if it is set, to Delete all saved game profiles as show below.
This should only be done AFTER the current game has been loaded or a New Game has been selected. We have added the above Condition to the Main Scene.
Last modified 1yr ago
Copy link