Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Compressing/Decompressing 7zip save game files in Unity

Discussion in 'Scripting' started by radglade, Sep 23, 2014.

  1. radglade

    radglade

    Joined:
    Feb 17, 2014
    Posts:
    19
  2. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,513
    I know there are several libraries for compression out there that are available for the .Net/mono frameworks.

    For example this one:
    https://sharpcompress.codeplex.com/

    You'll have to test it to see if it works on all your target platforms. Windows is almost always a given for support, but mac/linux/android/xbox/etc, you always need to fully test to see if it actually works. There's always grey zone there.

    Most things like this aren't unity specific, and if they are it's really just a clean up of existing projects to make the API more inline with unity.
     
  3. Kogar

    Kogar

    Joined:
    Jun 27, 2013
    Posts:
    80
  4. Cygon4

    Cygon4

    Joined:
    Sep 17, 2012
    Posts:
    382
    One small remark: if you're doing mobile, 7-Zip's LZMA may not be a good match. The algorithm uses a dictionary in the range of hundreds of megabytes that needs to be (incrementally) formed and kept in memory.

    Otherwise, the LZMA SDK linked by Kogar will provide everything you need. It includes C# code for LZMA compression/decompression that will work in Unity and the .7z format is mostly documented or can be understood through the portable 7-Zip extractor source code (C++).