参考雨松的LZMA SDK使用方法:
http://www.xuanyusong.com/archives/3095
转自http://blog.csdn.net/huutu http://www.thisisgame.com.cn
计划在项目中使用 不压缩的Assetbundle ,所以需要对Assetbundle 进行手动压缩打包,因为之前有对 十万个冷笑话的打包分析,所以这次坚定选择 LZMA压缩算法来压缩Assetbundle。
转自http://blog.csdn.net/huutu http://www.thisisgame.com.cn
Note:
因为暂时不知道LZMA如何压缩与解压文件夹,所以目前是计划对文件夹进行UPK打包成UPK文件,然后LZMA压缩。解压的话先解压出来UPK文件,然后读取UPK文件来释放出源文件。
LZMA 官网下载SDK
http://www.7-zip.org/sdk.html
下载过来后直接把C#里面的7zip拖到Unity中,这时Setting.cs 会报错,删除它。
Note:
本文示例中的 LZMA SDK源代码被我修改了。
转自http://blog.csdn.net/huutu http://www.thisisgame.com.cn
代码如下:
using UnityEngine;using System.Collections;using SevenZip;using System.IO;using UnityEditor;using System;using System.Threading;using UnityEngine.UI;public class NewBehaviourScript : MonoBehaviour { [SerializeField] Slider m_Slider; CodeProgress m_CodeProgress=null;//进度; Thread m_CompressThread=null; //压缩线程; Thread m_DecompressThread=nul