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)
Related Posts
Leave a comment
Recent posts
- UnityHub: Enable built-in Login Dialog (no more browser login/logout issues!)
- Use TikTok-TTS in Unity (with WebRequest)
- Create Scene Thumbnail Image using OnSceneSaved & OnPreviewGUI
- webgl+javascript TTS
- Using Moonsharp (LUA) + Unity Webgl
- Using 3D gameobject prefabs with Unity Tilemap + NavMesh Surface
- Custom Unity Hub Project Template Preview Image/Video (using HTML+CSS in package description)
- Check if point is inside polygon 2D (using line intersection)
- UnityHub: Enable Create Project Button (without having to select Cloud Organization)
- UI: Make Tooltip background fit Text content length
- Pong-Wars in Unity
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub)