Hello everyone. I need to encrypt my assetBundles and download them into WebPlayer.
I use default code from example:
string url = "http://www.mywebsite.com/mygame/assetbundles/assetbundle1.unity3d";
IEnumerator Start () {
// Start a download of the encrypted assetbundle
WWW www = new WWW (url);
// Wait for download to complete
yield return www;
// Get the byte data
byte[] encryptedData = [url]www.bytes;[/url]
// Decrypt the AssetBundle data
byte[] decryptedData = YourDecryptionMethod(encryptedData);
// Create an AssetBundle from the bytes array
AssetBundle bundle = AssetBundle.CreateFromMemory(decryptedData);
// You can now use your AssetBundle. The AssetBundle is not cached.
}
This is how I save the bundle:
BuildPipeline.BuildAssetBundle(objects[0], objects, bundlePath,
BuildAssetBundleOptions.CollectDependencies,
BuildTarget.WebPlayer);
I don’t use Push/Pop Dependencies.
Even when I don’t use BuildAssetBundleOptions.CollectDependencies (when bundle contains of only one texture asset) - it still doesn’t creates from memory in webplayer.
Webplayer log says:
Asset bundle is incomplete
I try this from webplayer in browser (Chrome/Firefox).
My Unity version is 4.2.1f4 pro trial