关于unity 3d load assetbundle的区别

时间:2014-11-20 09:21:02

标签: unity3d

在正常情况下,我像这样加载assetbundle

WWW www = WWW.LoadFromCacheOrDownload("http://x.x.x.x/player.unity3d", 3);
yield return www;

但我想通过差异文件加载assetbundle,例如 我有一个不同的文件,如:http://x.x.x.x/player.unity3d.diff

我通过bsdiff(daemonology.net/bsdiff

生成差异

我的问题是;如何通过player.unity3d.diff加载assetbundle?

我想谷歌,但我找不到任何东西。

1 个答案:

答案 0 :(得分:0)

Unity不支持加载bsdiff'ed文件,但您可以自己实现它。例如:

// Load asset bundle
WWW www1 = WWW.LoadFromCacheOrDownload("original.bundle");
// Load diff
WWW www2 = WWW.LoadFromCacheOrDownload("updated.bundle.diff");

// Get bytes for both assets
byte[] original = www1.bytes;
byte[] diff = www2.bytes;

// Apply diff
byte[] updated = ApplyBspatch(original, diff);

// You can save updated bundle at this point to a file.

// Finally, create asset bundle
AssetBundle bundle = AssetBundle.CreateFromMemory(updated);

以下是C#中用于修补的bsdiff实现之一:https://github.com/LogosBible/bsdiff.net