here is my test case to download 5 different bundle and cache them
i found that if any download starts with the same bundle name and ends with “.” + what ever, will treat as the same file, but it’s not! is that a limitation or a bug?
i know there is a rule mentioned "And apparently “MyAssets”+“hd” and “MyAssets.hd”+”” cannot coexist as they lead to the same full AssetBundle name." in thread __http://forum.unity3d.com/threads/new-assetbundle-build-system-in-unity-5-0.293975/__
i think i should be a bug, because the system limit the file name even we don’t need to deal with variant.
public void DownloadTest()
{
StartCoroutine( Test() );
}
public IEnumerator Test()
{
List<WWW> w = new List<WWW>();
// will not error
// w.Add( WWW.LoadFromCacheOrDownload( MGBundleManager.GetLocalBundleUrl() + "Audio/Music001", 0 ) );
// w.Add( WWW.LoadFromCacheOrDownload( MGBundleManager.GetLocalBundleUrl() + "Audio/Music002", 0 ) );
// w.Add( WWW.LoadFromCacheOrDownload( MGBundleManager.GetLocalBundleUrl() + "Audio/Music003", 0 ) );
// w.Add( WWW.LoadFromCacheOrDownload( MGBundleManager.GetLocalBundleUrl() + "Audio/Music004", 0 ) );
// w.Add( WWW.LoadFromCacheOrDownload( MGBundleManager.GetLocalBundleUrl() + "Audio/Music005", 0 ) );
// will error
// [myrul]/Audio/char1.attack2:Cannot load cached AssetBundle. A file of the same name is already loaded from another AssetBundle.
// which char1.attack1 ~ char1.attack5 is NOT Variant
w.Add( WWW.LoadFromCacheOrDownload( MGBundleManager.GetLocalBundleUrl() + "Audio/char1.attack1", 0 ) );
w.Add( WWW.LoadFromCacheOrDownload( MGBundleManager.GetLocalBundleUrl() + "Audio/char1.attack2", 0 ) );
w.Add( WWW.LoadFromCacheOrDownload( MGBundleManager.GetLocalBundleUrl() + "Audio/char1.attack3", 0 ) );
w.Add( WWW.LoadFromCacheOrDownload( MGBundleManager.GetLocalBundleUrl() + "Audio/char1.attack4", 0 ) );
w.Add( WWW.LoadFromCacheOrDownload( MGBundleManager.GetLocalBundleUrl() + "Audio/char1.attack5", 0 ) );
List<AssetBundle> l = new List<AssetBundle>();
int i = 0;
while( true )
{
List<WWW> r = new List<WWW>();
foreach( WWW www in w )
{
if( !string.IsNullOrEmpty( www.error ) )
{
Debug.LogError( www.url + ":" + www.error );
i++;
}
else if( www.isDone )
{
l.Add( www.assetBundle );
i++;
r.Add( www );
}
}
foreach( WWW www in r )
{
Debug.Log( www.url + " is done" );
w.Remove( www );
www.Dispose();
}
if( w.Count == 0 )
{
Debug.Log( "over" );
break;
}
yield return null;
}
}