AutoSaver Toggle for Godot Editor (C#)
by vrravalos
AutoSaver Toggle for Godot Editor (C#)
AutoSaver is a peace-of-mind plugin for Godot 4 that enables a toggle to automatically save the currently open scenes and files based on a timer schedule (default is 60 seconds) and/or when the application loses focus. The plugin has some optional configuration to customize the experience.
Note
The AutoSaver Toggle for Godot Editor is currently in early development. While it is functional, it may have unexpected behaviors. I welcome feedback and contributions to improve its stability and features such as porting to GDScript. Check Contributions section for more info.
Motivation š
You know how valuable your time is and how frustrating it is to lose unsaved work.š±
Features š£
- Toggle autosave functionality in the Godot editor
- Prevent saving during active editing (scenes)
- Integration with Godot's built-in autosave features
- Easy-to-use settings panel in the Godot editor
What this plugin does ā
- Automatically saves open text files (.gd, .txt, etc.) and scene files (.tscn) in the Godot editor at regular intervals.
- Provides an optional feature to save files when the Godot editor loses focus (disabled by default).
- Compatible with
GDScript
-only projects when using Godot Engine for .NET (see Troubleshoothing)
What this plugin does not do ā.
- This plugin does not create an autosave system for your game projects.
- It's not a replacement for version control systems like Git.
- This plugin doesn't create backups or multiple versions of your files; it simply saves the current state of open files in Godot.
Minimum Requirements
- Godot Engine - .NET (version 4.2.2 or higher)
- A Godot project configured to use C# (see Troubleshooting for more info)
Installation š§
- Download the latest version from the GitHub repository.
- Put the plugin folder
autosaver_editor
into theaddons
folder of your Godot project. - Enable the plugin in Godot:
Project > Project Settings > Plugins > AutoSaver Toggle for Godot Editor
.
Troubleshooting ā ļø
If you encounter the following error when activating the plugin
"Unable to load addon script from path: 'res://addons/autosaver_editor/AutoSaverEditorPlugin.cs'. This might be due to a code error in that script. Disabling the addon at 'res://addons/autosaver_editor/plugin.cfg' to prevent further errors."
Please make sure that
- Your Godot project is properly set up as a .NET project.
- There's a
.csproj
file in your project root (Godot automatically creates this when you add your firstC#
script). - Your project has been successfully compiled ("Build Project" button).
To set up your project:
- Use the Godot Engine - .NET version for your project.
- Create a simple .cs file in the FileSystem dock (right-click > New Script > C# Script).
- Wait a few seconds (Godot needs time to create the CS project) and check the root folder.
- Before activating the plugin, build the project by clicking the hammer icon šØ ("Build Project" button) in the top right menu (next to the play button).
- After a successful build, try to activate the plugin again.
If the issue persists after following these steps, please check the Godot console output for more detailed error messages and make sure that all plugin files are placed correctly in your project structure.
Configuration āļø
By default, the plugin is set to a 60 second interval.
An optional configuration can be set in the settings.ini
file located in the root folder of this plugin.
After activating the plugin, you can access its settings through the plugin panel, where you can adjust the autosave interval:
The interval configuration for saving files (.gd, .txt, etc.) in the Script Editor is directly linked to the built-in Godot editor configuration for saving files: Godot UI: Editor > Editor Settings > Interface > Text Editor> Behavior > Autosave Interval Secs.
The optional "autosave on focus loss" configuration is disabled by default, it uses the built-in Godot editor autosave on focus loss configuration Godot UI: Editor > Editor Settings > Interface > Editor > Save on Focus Loss. To enable it, edit the settings.ini
file:
use_gd_editor_save_on_focus_loss=true
Known issues š©
- Hovering over some parts of the Godot editor's UI (such as the plugin's UI elements) can prevent the plugin's internal trigger from working.
- The "autosave on focus loss" option, which relies on Godot's built-in editor settings "Save on Focus Loss",caused some .cpp errors in the Godot output console during testing while writing this plugin.
Contributions š¤²
Contributions are welcome! If you'd like to help create the GDScript
version or improve the existing C#
version, please feel free to submit pull requests or open issues to this GitHub repository.
License āļø
This project is licensed under the MIT License - see the LICENSE file for details.
If this code helps you and if you'd like to give me credit, Victor R. R. Avalos, it would be greatly appreciated. š
Download
Support
If you need help or have questions about this plugin, please contact the author.
Contact Author