Loading Webplayer builds via WWW.LoadFromCacheOrDownload

I want to download a webplayer build through WWW.LoadFromCacheOrDownload() and load it using WWW.LoadUnityWeb():

WWW cachedDownload = WWW.LoadFromCacheOrDownload( "web_build.unity3d", version );
yield return cachedDownload;
if ( cachedDownload.error != null )
{
    Debug.LogError( cachedDownload.error );
    cachedDownload.Dispose();
    yield break;
}
else
{
    cachedDownload.LoadUnityWeb();
}

But as soon as the download is finished I'm getting the error "Cannot load cached AssetBundle." Downloading the same file using the usual WWW constructor works fine. I have a valid Unity Caching License and the caching in general is working, so that is not causing any problems. I guess that the web build is treated like an AssetBundle on deserialization and that is of course failing.

So my question is - were web builds never considered to be cachable or is this a bug?

Thanks, Thomas

The easiest workaround I found so far is, to just create an AssetBundle from the complete scene by building it as streamed scene:

BuildPipeline.PushAssetDependencies();
//create asset bundle
BuildPipeline.BuildPlayer(new string[] { "MyScene.unity" }, "AssetBundle.unity3d", BuildTarget.WebPlayer, BuildOptions.BuildAdditionalStreamedScenes);
//create webplayer build
BuildPipeline.BuildPlayer(new string[] { "MyLoader.unity", "MyScene.unity" },"Player.unity3d", BuildTarget.WebPlayerStreamed, BuildOptions.ShowBuiltPlayer);
BuildPipeline.PopAssetDependencies();

And then load the bundle inside of my loader scene the following way:

WWW cachedDownload = WWW.LoadFromCacheOrDownload("MyScene.unity3d", 1);
yield return cachedDownload;
//load the asset bundles
cachedDownload.assetBundle.LoadAll();
//load game level
Application.LoadLevel(1);

That seems to work pretty fine and the unity caching is kicking in too :)

do you own a cache addon license? otherwise you can't use the unity webplayer caching technology and have to create assetbundles that are small enough for the browser to keep it in his cache

How much does a cache license cost? Heard it is quite expensive but haven’t been able to source a price, yet.