Infinite Saves
Learn how to set up infinite saves for your Unity game.
Last updated
Learn how to set up infinite saves for your Unity game.
Last updated
For this section, we will go through how infinite saves can be set up for your game by using the InfiniteSavesExample scene as a reference, which can be found in Assets/StylishEsper/ESave/InfiniteSavesExample
.
You will need some sort of UI setup that can support infinite saves. Generally, a scroll rect is required for this case. The scroll rect will be populated with save slot buttons. There should be a button for creating a new save slot—where this is located is up to you.
We will start by creating a UI button that will both load and overwrite data. This will be a prefab. You can make a prefab by dragging the object into the project window.
After that, create a button that will create save slots. This does not need to be a prefab. Both buttons will be children of the scroll rect's content for this example.
Delete the save slot button from the hierarchy, as it will be instantiated at runtime.
You will need a way to switch from loading a save to overwriting a save and vice versa. Generally, games have you navigate to a 'Load Game' section to load a game and a 'Save Game' section to overwrite a save or create a new one. For this example, we will simply be using a toggle to switch between saving and loading. Additionally, at the bottom-left, we will have a button that will delete all saves.
The data we will be saving will only be the time elapsed. So, there is a text object below the scroll rect that will display the current time elapsed.