Search Unity

Compressing stuff - example?

Discussion in 'Scripting' started by Lugzan, Apr 9, 2008.

  1. Lugzan

    Lugzan

    Joined:
    Mar 6, 2008
    Posts:
    9
    Anyone have an working example on how to compress e.g. a string in c#?

    I have tried using System.IO.Compression.GZipStream and it compiles fine. But when playing, Unity produces the following error:
    Code (csharp):
    1. DllNotFoundException: MonoPosixHelper
    I have tried using ICSharpCode.SharpZipLib.Zip because I found the ICSharpCode.SharpZipLib.dll in Unity's Mono.framework folder, but it wont even compile:
    Code (csharp):
    1. The type or namespace name `ICSharpCode' could not be found. Are you missing a using directive or an assembly reference?
     
  2. AngryAnt

    AngryAnt

    Keyboard Operator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
    Did you check, like the error message suggests, that you are indeed "using ICSharpCode;"?
     
  3. Lugzan

    Lugzan

    Joined:
    Mar 6, 2008
    Posts:
    9
    Yep, I did :)
     
  4. Lugzan

    Lugzan

    Joined:
    Mar 6, 2008
    Posts:
    9
    Bump-e-ti-bump
     
  5. AngryAnt

    AngryAnt

    Keyboard Operator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
    Could be that unity is not including the needed DLL on compile. If that is the case then it ought to be solvable by dropping the DLL right in the assets folder as I suggested here: http://forum.unity3d.com/viewtopic.php?t=8432
     
  6. Lugzan

    Lugzan

    Joined:
    Mar 6, 2008
    Posts:
    9
    Thanks, that fixed the problem! :)

    I copied the SharpZipLib DLL located inside the Unity package at
    Code (csharp):
    1. Unity.app/Contents/Frameworks/Mono.framework/ICSharpCode.SharpZipLib.dll
    into to the folder
    Code (csharp):
    1. <project folder>/Assets/Plugins
    I find it strange how Unity does not recognize the DLL by itself, but that you manually have to copy it into your project, when the DLL is in fact shipped with Unity.
     
  7. tgraupmann

    tgraupmann

    Joined:
    Sep 14, 2007
    Posts:
    828
    Thanks, I was just going to post about this exact same issue.