Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Unity asset bundle (UnityFS)

From ReverseEngineering.wiki
Format
Versions format version 6, 7, 8 seen in UnityPy; older signatures UnityWeb, UnityRaw, UnityArchive
Magic 55 6E 69 74 79 46 53 00 ("UnityFS\0")
Extensions .unity3d, .assetbundle, .bundle, .ab (also none)
Endianness big endian (header and block table)
On this wiki Facts · Code · Notes · Topics

Container of Unity (5.3 and later) for AssetBundles and the data files of many games: the ASCII signature "UnityFS", a big-endian header with player and engine version strings, a compressed block table (LZMA, LZ4 or LZ4HC blocks) and a directory of nodes, usually one SerializedFile (CAB-<hash>) plus .resS/.resource streams.

Overview

A UnityFS file stores several named files ("nodes") in compressed blocks. Typical nodes: a Format:Unity serialized file named CAB-<32 hex digits> and optional CAB-<hash>.resS / .resource streams that hold texture, mesh and audio payloads. Addressables, AssetBundles and the data.unity3d of some builds all use it. Older Unity (3.x-5.2) used the signatures UnityWeb, UnityRaw (format versions 2-6, LZMA for UnityWeb) and UnityArchive; UnityPy reads the first two and raises NotImplementedError for UnityArchive.

Header

All integers are big endian; strings are NUL-terminated.

Field Type Notes
signature cstring UnityFS
format version uint32 6 is common for Unity 5.3-2018; UnityPy aligns the header for 7 and higher (Unverified: 7 from Unity 2019, 8 from a later release)
player version cstring normally 5.x.x
engine version cstring the Unity version that built it, for example 2019.4.15f1
size int64 total size of the file
compressed size uint32 size of the compressed block table
uncompressed size uint32 size of the block table after decompression
flags uint32 see below

If the format version is 7 or higher, or the engine version is 2019.4.15 or later, the reader aligns to 16 bytes after the header. The block table follows the header, or, with flag 0x80, sits at the end of the file (offset = file length - compressed size).

Flags

Mask Meaning
0x3F compression of the block table (0 none, 1 LZMA, 2 LZ4, 3 LZ4HC, 4 LZHAM)
0x40 block table and directory are stored together
0x80 block table is at the end of the file
0x100 old web-plugin compatibility
0x200 AssetStudio: BlockInfoNeedPaddingAtStart, the stream is aligned to 16 bytes after the block info, before the data; UnityPy treats the same bit as an encryption flag for engine versions before 2020.3.34 / 2021.3.2 / 2022.1.1
0x400 / 0x1000 newer encryption flag (value depends on engine version)

UnityPy picks the old or new flag meaning from the engine version: the old meaning for versions before 2020.1, 2020.x before 2020.3.34, 2021.x before 2021.3.2 and 2022.x before 2022.1.1. A file that decompresses to garbage with a correct compression flag is probably encrypted by the game.

Block table (after decompression)

  1. 16-byte hash of the data
  2. int32 block count; per block: uint32 uncompressed size, uint32 compressed size, uint16 flags (low 6 bits: compression, same numbering)
  3. int32 node count; per node: int64 offset, int64 size, uint32 flags, cstring path

The blocks are decompressed one by one and concatenated; node offsets are relative to that concatenated stream.

Per AssetStudio (AssetStudio/BundleFile.cs lines 218-357) a header with version 7 or higher is followed by 16-byte alignment before the block info; block flag 0x40 means streamed. Details: Fact:Unity asset bundle (UnityFS)/behavior/Block info location, padding and block decompression, flags Fact:Unity asset bundle (UnityFS)/enum/ArchiveFlags.

Legacy UnityWeb and UnityRaw

The older signatures share the first strings of the header; their layout (hash, crc, level table, LZMA for UnityWeb) is in Fact:Unity asset bundle (UnityFS)/behavior/Legacy UnityWeb and UnityRaw header. Unity WebGL .data files use a different little-endian directory container: Fact:Unity asset bundle (UnityFS)/behavior/WebGL data file container.

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

  • A bundle built for a Unity version whose serialized-file version your tool does not know fails after unpacking, not in the container.
  • Games with their own AssetBundle encryption or a modified block table do not parse with stock tools; the engine version string in the header still gives the Unity version.
  • LZ4 blocks are raw LZ4 blocks without frame header (Format:LZ4); LZMA blocks use Format:LZMA with the 5-byte properties header and no size field. Unverified: check the exact LZMA header against your sample.

Tools

UnityPy (Python, MIT), AssetRipper, AssetStudio, UABE. See also Library:Unity.