Skip to content

General Usage

Amethyst-szs edited this page Nov 26, 2023 · 1 revision

Installing Plugin

  1. Download the most recent release
  2. Copy the addons/savedata-dx directory into your project's res://addons/ directory
  3. Enable under Project Settings -> Plugins
    image

Using SaveData menu

After installing the plugin, a new menu will be added in the top bar with your other editor screens. This menu has three main modes, each can be selected in the top-left corner of the UI. Each mode will be detailed below.
image

Inspector Mode

This mode is used to view and modify your save data. All data saved using this plugin is encrypted, making it not work with a standard text editor. This helps prevent the end-user from breaking their save file. To view one of your save files, click the Open button or press Ctrl+O. Then select the common data or a specific save slot to view!
image
When opened, you'll get a full JSON file representing your save data! This can be modified in-editor, including warning and error checks to ensure you provide a valid JSON input when saving.
image

Slot Mode

This mode allows you to modify the script for each save slot the player can make. This is extremely similar to the "Script" panel built-in to Godot. Your save slot script is a standard GDScript file, and can include variables, constants, functions, and more! But make sure to note, every variable declared here will be saved to disk, so it's not recommended to write much game logic here.

In order to organize your save data, you'll want to create other classes. Hit the New button on the top of the window and select the folder and file name of your new script. It's recommended to add .gd to the end of your file name so the engine knows this is a GDScript file.
image

The newly opened script can then be modified to include anything you want. It's worth noting that you don't need to add extends or class_name to the top of your script.

In order to use the new script you made, hit Close or "Ctrl+W" to return to the root script you started on. Then, hitting Import or "Ctrl+I" will allow you to select the script you previously created and add it as a preload. Now you use this new class/script freely!
image

The SaveData slot editor does not include error checking like Godot's built-in script editor. If you're doing complex work and would like intellisense, it's recommended to open the file in the normal script editor.

Common Mode

The Common Mode is almost identical to the Slot Mode. This mode is for modifying the common data which is shared globally between all save files. A common use case for this would be config settings like resolution. For more info on this section, please read the Slot Mode docs.

Clone this wiki locally