+1 vote

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.

Thx

in Engine by (848 points)

2 Answers

0 votes

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

ProjectSettings.get_setting("application/config/<your_property>"
by (14 points)
+2 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'))
    else:
        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 (45 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 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 webmaster@godotengine.org with your username.