Outdated documentation

This documentation page refers to Godot 4.3, and may be outdated or incorrect.
Additionally, this engine version is no longer supported.

Check this page in the stable branch for the latest additions and corrections.

PCKPacker

Inherits: RefCounted < Object

Creates packages that can be loaded into a running project.

Description

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()

The above PCKPacker creates package test.pck, then adds a file named text.txt at the root of the package.

Methods

Error

add_file(pck_path: String, source_path: String, encrypt: bool = false)

Error

flush(verbose: bool = false)

Error

pck_start(pck_name: String, alignment: int = 32, key: String = "0000000000000000000000000000000000000000000000000000000000000000", encrypt_directory: bool = false)


Method Descriptions

Error add_file(pck_path: String, source_path: String, encrypt: bool = false) 🔗

Adds the source_path file to the current PCK package at the pck_path internal path (should start with res://).


Error flush(verbose: bool = 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(pck_name: String, alignment: int = 32, key: String = "0000000000000000000000000000000000000000000000000000000000000000", encrypt_directory: bool = 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).


User-contributed notes

Please read the User-contributed notes policy before submitting a comment.