
Thus, use the following guidelines when using low-level loading API in your games: * When downloading a bundle using WWW, WebRequest there is also an 8圆4KB accumulator buffer which stores data from a socket. Perf: LZMA decompression + LZ4 compression during download. Perf: reading from disk + LZMA decompression + LZ4 compression. Perf: LZMA decompression + LZ4 compression. Memory: uncompressed bundle size + (while Memory: LZ4HC compressed bundle size + (while Memory: LZ4 compressed bundle size + (while LoadFromCacheOrDownload This table provides a comparison of memory and performance overheads when using different compression types and different loading methods. It affects bundles cached to disk and stored in memory. After that, data is read from the cached bundle by decompressing chunks on-the-fly when needed.Ĭache compression is enabled by default and is controlled by the pressionEnabled property. This recompression occurs during the download streaming, which means the cache compression begins as soon as enough of the data is downloaded, and continues incrementally until the download is complete. As data arrives from the socket, Unity will decompress it and recompress it in LZ4 format. Recompression happens during download and thus is almost unnoticeable by the end users. This saves 40%–60% of space compared to uncompressed bundles. The From Unity 5.3 onwards, cached data can also be compressed with the LZ4 algorithm. Uncompressed bundles are large, but are the fastest to access once downloaded.


The third compression option is no compression at all. The LZ4 Format was introduced in Unity 5.3 and was unavailable in prior versions.

This occurs on-the-fly, meaning there are no wait times for the entire bundle to be decompressed before use. LZ4 is a “chunk-based” algorithm, and therefore when objects are loaded from an LZ4-compressed bundle, only the corresponding chunks for that object are decompressed. Unity also supports LZ4 compression, which results in larger compressed file sizes, but does not require the entire bundle to be decompressed before use. LZMA-Compressed bundles give the smallest possible download size, but has relatively slow decompression resulting in higher apparent load times. The standard compressed format is a single LZMA stream of serialized data files, and needs to be decompressed in its entirety before use. LZMA Formatīy default, when Asset Bundles are built, they are stored in a compressed format. Unity supports three compression options for Asset Bundles: LZMA, LZ4, and Uncompressed.
