May
12
2019

Using SharpCompress in Unity

If you need to work with zip/rar/tar/gzip packages, can use SharpCompress to handle opening or creating those files.

Compile SharpCompress DLL (unless you can find it online somewhere)

  • Download project https://github.com/adamhathcock/sharpcompress
  • Unzip and open in VisualStudio (i used 2017)
  • Security warning, press ok
  • Security warning, press ok
  • View / Solution Explorer .. (if not already visible)
  • Right click over SharpCompress, select Build
  • Now you should have the dll in ..\sharpcompress-master\sharpcompress-master\src\SharpCompress\bin\Debug\ folder (3.5 and 4.5 versions, pick which one you like, recent unity versions support 4.5 by default, so lets pick “net45\SharpCompress.dll”)
  • Copy it to your unity project, under Assets\Plugins\SharpCompress\ SharpCompress.dll
  • If you are using Unity 2017.x or lower, go to Player Settings / Other settings, and enable 4.6 from “Scripting Runtime Version”
  • Test creating zip package with the script below (adjust source and output folders in the script)

Source:
https://gist.github.com/unitycoder/edfc22570e93db61f83d582c98c4dff5

TroubleShooting

Error in Android build:
“NotSupportedException: ..il2cpp\libil2cpp\icalls\mscorlib\System.Reflection.Emit\DynamicMethod.cpp(19) : Unsupported internal call for IL2CPP:DynamicMethod::create_dynamic_method – System.Reflection.Emit is not supported.
05-12 01:52:09.319 2523 2549 E Unity : at System.Reflection.Emit.DynamicMethod.CreateDynMethod ()”

Solution:
Use Mono as Scripting Backend (IL2CPP gives that error)


Leave a comment

Connect

Twitter View LinkedIn profile Youtube Youtube Join Discord Twitch Instagram

UnityLauncherPro

Get UnityLauncherPRO and work faster with Unity Projects!
*free unity hub alternative

@unitycoder_com

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.