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.

PackedByteArray

A packed array of bytes.

Description

An array specifically designed to hold bytes. Packs data tightly, so it saves memory for large array sizes.

PackedByteArray also provides methods to encode/decode various types to/from bytes. The way values are encoded is an implementation detail and shouldn't be relied upon when interacting with external apps.

Note

There are notable differences when using this API with C#. See C# API differences to GDScript for more information.

Constructors

PackedByteArray

PackedByteArray()

PackedByteArray

PackedByteArray(from: PackedByteArray)

PackedByteArray

PackedByteArray(from: Array)

Methods

bool

append(value: int)

void

append_array(array: PackedByteArray)

int

bsearch(value: int, before: bool = true)

void

clear()

PackedByteArray

compress(compression_mode: int = 0) const

int

count(value: int) const

float

decode_double(byte_offset: int) const

float

decode_float(byte_offset: int) const

float

decode_half(byte_offset: int) const

int

decode_s8(byte_offset: int) const

int

decode_s16(byte_offset: int) const

int

decode_s32(byte_offset: int) const

int

decode_s64(byte_offset: int) const

int

decode_u8(byte_offset: int) const

int

decode_u16(byte_offset: int) const

int

decode_u32(byte_offset: int) const

int

decode_u64(byte_offset: int) const

Variant

decode_var(byte_offset: int, allow_objects: bool = false) const

int

decode_var_size(byte_offset: int, allow_objects: bool = false) const

PackedByteArray

decompress(buffer_size: int, compression_mode: int = 0) const

PackedByteArray

decompress_dynamic(max_output_size: int, compression_mode: int = 0) const

PackedByteArray

duplicate()

void

encode_double(byte_offset: int, value: float)

void

encode_float(byte_offset: int, value: float)

void

encode_half(byte_offset: int, value: float)

void

encode_s8(byte_offset: int, value: int)

void

encode_s16(byte_offset: int, value: int)

void

encode_s32(byte_offset: int, value: int)

void

encode_s64(byte_offset: int, value: int)

void

encode_u8(byte_offset: int, value: