0 votes

I'm working on an application that needs to be able to generate PCKs on the fly. I'm calling the application via something like this in GDScript:

OS.execute(OS.get_executable_path(), ["--export-pck", etc, etc])

This works in the editor preview, but if I try to export the project (for MacOS in my case), and I try to do ./path/to/my/export --help, it doesn't list --export-pck as a valid command line switch. I'm exporting from a tools-enabled 3.3.2 build of Godot. Do I need to do something else in addition?

Godot version 3.3.2 (tools-enabled)
in Engine by (15 points)

1 Answer

+1 vote
Best answer

Your problem here is the fact that the default export template doesn't include the tools portion (i.e. editor-only features like the pck export command line option) and it's not needed at all. Your snippet works in the editor, since that's using the full editor executable for obvious reasons.

Rather than calling your own program with command line parameters, you should instead use PCKPacker in GDScript:

var packer = PCKPacker.new()
packer.pck_start("my-export.pck")
packer.add_file("res://first.txt", "second.txt")
packer.flush()
by (224 points)
selected by

Thanks! I didn't find a reference to this class in the PCK documentation. Does this mean I don't actually need a tools-enabled build at all if I just use this class and ProjectSettings.load_resource_pack?

You don't need any special build for this to work. "tools enabled" only means it's a full build for/of the Godot Editor, not just the runtime (i.e. export template).

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.