Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Any more info on the new "CompressWithLz4" BuildOption?

Discussion in '5.6 Beta' started by Zenix, Feb 17, 2017.

  1. Zenix

    Zenix

    Joined:
    Nov 9, 2009
    Posts:
    213
    Is there any more information on the new BuildOption 'CompressWithLz4'? eg. What exactly gets compressed and what are the potential downsides (increased load times or memory usage?)
     
  2. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    295
    I haven't checked the beta 8 yet, but I'm hoping it would compress all assets (at least outside StreamingAssets, not sure if those get the treatment as well). I'd appreciate some more info, too.
     
    alexeyzakharov likes this.
  3. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    Hi!

    The option is equivalent to BuildAssetBundleOptions.ChunkBasedCompression and allows to compress Player's data with LZ4. (See also AssetBundleInternalStructure).
    That affects all data related to scenes and resources (Resources folder) you build player with. Data in StreamingAssets folder is not compressed and copied as is like before.

    The following section has been added to the scripting api docs (should be updated soon):

    Use chunk-based Lz4 compression when building the Player.
    This value allows the data to be stored in a compressed form when the Player is deployed to a device. Decompression is performed in real time when the Player reads the data. Scene or Asset loading might be faster or slower depending on disk read speed when compared to using uncompressed data.

    Compressed data files include:
    1. Player settings - ''globalgamemanagers'' and ''globalgamemanagers.assets'' files.
    2. Scenes and Assets - ''level*'' and ''sharedassets*.asset'' files.
    3. Resources - ''resources.assets'' files.
    4. GI data.
    5. Built-in resources - ''unity_builtin_extra'' file.

    CompressWithLz4 sets compression parameters to Lz4 compression and splits data files into 128KB chunks.
    This feature is supported for Standalone, Android, iOS build targets and is default for WebGL target.
    Enabling CompressWithLz4 in Android might be a significant performance boost when loading data as Lz4 decompression is faster than the default Zip decompression.

    Note:
    Compression might affect the size of a game installer making it larger, even though size of the Player on a device is smaller. Subsequent compression is less efficient or even impossible.
     
    summerian, mh114 and Zenix like this.
  4. Zenix

    Zenix

    Joined:
    Nov 9, 2009
    Posts:
    213
    Awesome. Thanks for the information :)
     
  5. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    295
    That's exactly what I wanted to hear, great job! Thanks! :)