KoBeWi / Godot-Auto-Export-Version

Plugin for Godot that automatically updates your version every time you export the project.
https://godotengine.org/asset-library/asset/1430
MIT License
47 stars 4 forks source link
godot

Godot Auto Export Version

Ever wanted to display the current version of your game somewhere? You did, but you don't have idea what to display or you forget to update it every time? This plugin is for you.

Every time you export the project, application/config/version project setting will be updated. Use this setting anywhere to display the version. Now your version automatically updates and you don't need to remember to update your scenes.

Plugin setup

After you enable the plugin, go to Project Settings and configure it at addons/ExportAutoVersion section (advanced mode).

The last thing to do is to implement get_version() method in the version config file (res://auto_export_version_config_file.gd by default). It should return a String from some external source that contains your current version. A few "version providers" are included by default:

To use any of these providers just uncomment the line starting with #. All of them are methods that return a String, so you can combine them to your liking. Or you can write a custom one (also if you have some good idea, you can open an issue and it might be officially included with this plugin; the plugin originally started with only 2 providers).

How to use the version

After each project export, the plugin will update the version project setting, or version.gd file depending on configuration.

Example for using the setting:

extends Label

func _ready():
    text = "v%s" % ProjectSettings.get_setting("application/config/version")

Attach it to any Label and it will display the current version and auto-update after each project export. Now you can forget about it, because it's all automatic.

If you use the script version location, the code will be instead:

extends Label

func _ready():
    text = "v%s" % load("res://version.gd").VERSION

If you want to print/update the current version without exporting the project, you can use the option in Project -> Tools menu called 'Print and Update Current Version'. This will display the version and update it as if the export was started.

Special thanks to @Kubulambula for refactoring the plugin and porting it to Godot 4.0.


You can find all my addons on my profile page.

Buy Me a Coffee at ko-fi.com