Skip to main content

Module serialized

Module serialized 

Source
Expand description

The SerializedFile container: what globalgamemanagers, *.assets and levelN are.

Layout (container versions 21 and 22): a big-endian header followed by metadata in the file’s endianness: Unity version, target platform, whether type trees are embedded, the types (class id, stripped, script index, hashes), the object table (path id, data offset, size, type index), script references, external files, reference types and a user string. Objects’ bytes follow at the data offset. Version 21 stores metadata size, file size and data offset as 32-bit header fields, followed by an endianness byte and three reserved bytes; metadata starts at byte 20. Version 22 repeats those sizes after the legacy fields as 32/64/64-bit numbers plus eight reserved bytes; metadata starts at byte 48. Object offsets are unsigned 32-bit in version 21 and signed 64-bit in version 22.

Only versions verified against real data are read; others are refused. A file’s types may carry their type trees (an AssetBundle’s files do; a player build strips them and objects are decoded with a TypeTreePackage instead): they are read into SerializedType::tree, their common-string offsets resolved from the package for the file’s Unity version.

Structs§

Decoded
A decoded object: its value, and the bytes after what its type tree covers.
External
Another file this one’s pointers can name (file id = index + 1).
ObjectInfo
One entry of the object table.
ReferenceClass
The managed class a reference type ([SerializeReference]) names.
SerializedFile
A parsed SerializedFile: its header fields, type table, object table, script references and external files, with the file’s bytes kept so objects can be read from it.
SerializedType
One entry of a file’s type table: the class the objects of this type are of, as the file declares it.

Constants§

MONO_BEHAVIOUR
The MonoBehaviour class: its type tree covers the base fields; the script’s own fields follow.
VERSIONS
Container versions read (verified on real files).