Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
PCKPacker¶
Inherits: RefCounted < Object
Creates packages that can be loaded into a running project.
描述¶
The PCKPacker is used to create packages that can be loaded into a running project using ProjectSettings.load_resource_pack.
var packer = PCKPacker.new()
packer.pck_start("test.pck")
packer.add_file("res://text.txt", "text.txt")
packer.flush()
var packer = new PCKPacker();
packer.PckStart("test.pck");
packer.AddFile("res://text.txt", "text.txt");
packer.Flush();
The above PCKPacker creates package test.pck
, then adds a file named text.txt
at the root of the package.
Methods¶
add_file ( String pck_path, String source_path, bool encrypt=false ) |
|
pck_start ( String pck_name, int alignment=32, String key="0000000000000000000000000000000000000000000000000000000000000000", bool encrypt_directory=false ) |
Method Descriptions¶
Error add_file ( String pck_path, String source_path, bool encrypt=false )
Adds the source_path
file to the current PCK package at the pck_path
internal path (should start with res://
).
Error flush ( bool verbose=false )
Writes the files specified using all add_file calls since the last flush. If verbose
is true
, a list of files added will be printed to the console for easier debugging.
Error pck_start ( String pck_name, int alignment=32, String key="0000000000000000000000000000000000000000000000000000000000000000", bool encrypt_directory=false )
Creates a new PCK file with the name pck_name
. The .pck
file extension isn't added automatically, so it should be part of pck_name
(even though it's not required).