Asset Bundles
Unity AssetBundles store assets such as textures, audio clips, and prefabs in files that a game can load at runtime. AssetRipper recognizes supported Unity bundle formats by reading the header and other structures in the file. If you change how a bundle is stored on disk, AssetRipper may no longer recognize it or may fail to read it.
Changing the on-disk format
- Prepending null bytes: Adding null bytes before the bundle moves the Unity header away from the start of the file. A reader that expects the header at the start may reject the file, even though the original bundle bytes are still present.
- Encrypting the whole file: Encryption makes both the header and the contents unreadable to a standard bundle reader until the file is decrypted.
Renaming the file or changing its extension does not alter the bundle format. Unity's built-in compression options also keep the file in a standard bundle format; compression is not encryption.
Loading modified bundles in your game
Unity still needs to receive a valid bundle. If you add a prefix, your game's loading code needs to skip it before passing the bundle to Unity. If you encrypt the file, your game needs to decrypt it first. Test this in a built player on each target platform, not just in the Unity Editor.
These changes can prevent AssetRipper from opening the file as distributed, but they do not make extraction impossible. A player who can inspect the running game may be able to recover the bundle after the game has restored it to a format Unity can read.