Format:Unity serialized file
| Versions | serialized-file version 9 to 26 and higher |
|---|---|
| Extensions | .assets, .sharedAssets, levelN, globalgamemanagers, CAB-* |
| Endianness | header fields big endian; the rest follows the endian byte (little endian on all current platforms) |
| On this wiki | Facts · Code · Notes · Topics |
The SerializedFile of Unity (level files, sharedassets, globalgamemanagers, and the CAB-* node inside an asset bundle): a header with metadata size, file size, version and data offset, a Unity version string, a type table (optionally with type trees), an object table (path id, offset, size, type) and external references.
Overview
The SerializedFile holds the game objects of a Unity project (GameObject, Transform, Texture2D, MonoBehaviour ...) in the order of an object table. It is found loose in *_Data/ folders (level0, sharedassets0.assets, globalgamemanagers, resources.assets) and inside Format:Unity asset bundle (UnityFS) files. The same layout is read by UnityPy (UnityPy/files/SerializedFile.py).
Header
The file starts with four big-endian uint32: metadata size, file size, version, data offset. From version 9 on, a one-byte endian flag (1 = big endian, 0 = little endian) and three reserved bytes follow. From version 22 the header is wider: the four legacy fields are still read and the real values follow right after the endian byte and reserved bytes (AssetStudio SerializedFile.cs lines 60-66 and UnityPy SerializedFile.py lines 281-285 both overwrite metadata size, file size and data offset with the new values and ignore the old ones; neither source says what the legacy fields hold, so Unverified: whether they are zero) as metadata size (uint32), file size (int64), data offset (int64) and one unknown int64.
Metadata section (after the header)
In order, with the version in which each part appears:
- Unity version string (cstring, version 7 and later), for example
2020.3.12f1;0.0.0or empty means "see the bundle" - target platform (int32, version 8+): see Fact:Unity serialized file/enum/BuildTarget
- type tree enabled (bool, version 13+); stripped builds usually have it off
- type count and types: class id (int32), is_stripped (bool, 16+), script type index (int16, 17+), script id (16 bytes, 13+ for MonoBehaviour), old type hash (16 bytes), the type tree when enabled, and from version 21 reference-type names or dependencies
- object count and objects: path id, byte start (relative to data offset), byte size and type index; object entries are 8-byte aligned from version 14 on
- script types (version 11+), externals (other files: guid, type, path), ref types (20+), user information (5+)
Class ids name the type of each object, see Fact:Unity serialized file/enum/Common class ids. Without type trees a reader needs the class layouts of the matching Unity version (for example TypeTreeDumper output) or the game's own Managed/ assemblies for MonoBehaviour.
Format versions and Unity releases
AssetStudio (AssetStudio/SerializedFileFormatVersion.cs, lines 9-86) names the versions: 5 = Unity 1.2-2.0, 6 = 2.1-2.6, 7 = 3.0 beta (version string appears), 8 = 3.0-3.4 (target platform appears), 9 = 3.5-4.7 (endian byte and reserved bytes in the header), 11 = script type index, 13 = type tree hashes and the enable-type-tree flag, 14 = 64-bit aligned path ids, 15 = 5.0.1-5.4, 16 = 5.5 alpha (class ids refactored: type id indexes the type table), 17 = 5.5-2018.4, 19 = 2019.1 (type tree nodes gain a ref type hash), 20 = 2019.2 (ref types), 21 = 2019.3-2019.4 (type dependencies), 22 = 2020.1 and later (64-bit sizes). AssetStudio stops at 22; newer readers (UnityPy) continue. See Fact:Unity serialized file/enum/SerializedFileFormatVersion. Per-field rules: Fact:Unity serialized file/behavior/Header fields and version 22 widening, Fact:Unity serialized file/behavior/Type entry layout and type tree flag, Fact:Unity serialized file/behavior/Object info entry per version, Fact:Unity serialized file/struct/Type tree blob node, Fact:Unity serialized file/behavior/Type tree string offsets and common strings, Fact:Unity serialized file/behavior/Script types, externals and tail.
The enable-type-tree flag
From version 13 a bool says whether the type entries carry type trees (the field layout of each class). Release player builds usually have it off (Unverified: typical, the flag is just read); then the trees must come from the same Unity version (TypeTreeDumper data or the engine's built-in tables) and MonoBehaviour layouts from the game's assemblies. Asset bundles normally keep trees on.
Streamed data (.resS / .resource)
Large payloads are stored outside the object: Texture2D holds offset, size and a path to a .resS file (Fact:Unity serialized file/behavior/Streamed resources resS and StreamingInfo). In a bundle the .resS is another node of the same bundle.
Code & repositories
- https://github.com/K0lb3/UnityPy @
417d59522a998fdee9a9c2b29fe35f3063222457· license: MIT
Python reader/writer for Unity bundles and serialized files. Useful without running: UnityPy/files/BundleFile.py, SerializedFile.py, enums/ (ClassIDType, BuildTarget, TextureFormat, BundleFile flags).
Tested on: source read, not run: source read, not run: read BundleFile.py, SerializedFile.py and the enums; not run · checked 2026-10-18; last activity 2026-10-05 - https://github.com/Perfare/AssetStudio @
d158e864b556b5970709c2a52e47944d53aa98a2· license: MIT
C# Unity asset viewer; read SerializedFile.cs, SerializedFileFormatVersion.cs, BundleFile.cs, WebFile.cs, ClassIDType.cs, ResourceReader.cs, Classes/Texture2D.cs.
Tested on: source read, not run · checked 2026-10-18; archived; last activity 2022-12-08; Note: the latest release ships binaries; the wiki links only the source, never the binaries
Pitfalls
- Version thresholds above are those UnityPy applies; newer Unity releases keep adding versions (26 and up add shared subtrees).
- Texture, mesh and audio data are often not in this file but in a
.resSor.resourcestream referenced by offset and size from the object. - Il2Cpp builds hide class names of MonoBehaviour scripts: recover them with Format:IL2CPP global-metadata.dat.
See also Library:Unity.