+2 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 (858 points)

2 Answers

+1 vote

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

by (16 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'))
        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 (49 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.