How to Export Asset Bundles in Unity3D
Make Asset Bundles from Unity 3D
Are you wondering how you can make asset bundles in Unity 3D? You're in the right place!
An asset bundle is an archive file containing platform specific assets (Models, Textures, Prefabs, Audio clips, and even entire Scenes) that can be loaded at runtime.
Asset bundles can express dependencies between each other, e.g. a material in Asset Bundle A can reference a texture in Asset Bundle B. For efficient delivery over networks, asset bundles can be compressed with a choice of built-in algorithms depending on use case requirements (LZMA and LZ4).
Asset bundles can be useful for downloadable content (DLC), reducing initial install size, loading assets optimized for the end-user’s platform, and reducing runtime memory pressure.
What’s in an Asset Bundle?
Good question, actually “asset bundle” can refer to two different, but related things.
First is the actual file on disk. This we call the asset bundle archive, or just archive, for short, in this document. The archive can be thought of as a container, like a folder, that holds additional files inside of it.
These additional files consist of two types: the serialized file and resource files. The serialized file contains your assets broken out into their individual objects and written out to this single file.
The resource files are just chunks of binary data stored separately for certain assets (textures and audio) to allow us to load them from the disk onto another thread efficiently.
Second is the actual asset bundle object you interact with via code to load assets from a specific archive. This object contains a map of all of the file paths of the assets you added to this archive to the objects that belong to that asset that need to be loaded when you ask for it.
So how exactly do we do that?
This post is originally published by the author here. This version has been edited for clarity and may appear different from the original post.