+4 votes

Hey all,

is there a way to read from gdscript the Exported Version ?
For example in Android export dialog, we set the version code and version name.

That would be helpful to display to the user.


in Engine by (860 points)

Good question, and makes me wonder what the point of setting the version number/name is when exporting (especially for Windows)?

2 Answers

+2 votes

Try adding your own property to the project and then read it with:

by (18 points)
+3 votes

You can do something like this:

if OS.get_name() == "Android":
    var export_config: ConfigFile = ConfigFile.new()
    var err = export_config.load("res://export_presets.cfg")
    if err == OK:
        print(export_config.get_value("preset.1.options", 'version/code'))
        print(export_config.get_value("preset.1.options", 'version/name'))
        print('[engine_root] Error open export_presets.cfgs')

export_presets.cfg need to be added manually to list of files to be exported

maybe you will need to change this param "preset.1.options"

by (51 points)

Epic, works like a charm and saved my day :)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.