Demo sceneYou can find a very simple demo scene and its scripts at Simple Database > Demo Scenes. All the code used in the scene is very similar to the one we saw in the quickstart guide, the SaveManager class has the bulk of code.
There's two scripts used in this demo scene inside scripts folder:
- ButtonScript: A simple script to handle button events and pass parameters
- SaveFileManager: A script that serves as a way to connect the UI with the SaveFiles and their operations.
This demo scene allows you to see a list of existing save files, create new ones, open them and manage their contents by creating and deleting key/value pairs. To create a new save file just use the input box at the bottom left and click create. Lets create a new save file called "slot1".
Once created it will appear with the rest of the existing save files at the left of the screen. You can now delete or open this save file. We can now open or delete it. When a save file is opened the left side of the screen will be disabled, only one save file can be modified at a time. The right side of the screen will be enabled and now we can modify the contents of the save file. Lets open it.
We can now add contents to the save file by using the bottom-right input fields. When created we can delete them back too.
And that's all there is to this simple example! You can check the inner workings by taking a look at the SaveManager script if you want to dive further into it.