Пример #1
0
    private IEnumerator Initialize()
    {
#if UNITY_EDITOR
        // If we're in Editor simulation mode, we don't need the manifest assetBundle.
        if (SimulateAssetBundleInEditor)
        {
            yield break;
        }
#endif

        string bundleName = AssetBundlePlatformPathManager.GetPlatformAssetbundlePath();
        string assetName  = "AssetBundleManifest";
        WWW    download   = null;
        string url        = "";
        if (m_ManifestFromHttp == true)
        {
            url = AssetBundlePlatformPathManager.GetDownloadingHttpAssetBundleURL() + bundleName;
        }
        else
        {
            url = AssetBundlePlatformPathManager.GetAssetBundleDownloadingURL_StreamingAsset() + bundleName;
        }
        ATrace.Log("AssetBundle Manifest :" + url);


        download = new WWW(url);
        while (download.isDone != true)
        {
            yield return(0);
        }
        if (download.error != null)
        {
            ATrace.LogError(string.Format("AssetBundle Manifest load Error:{0}", download.error));
        }
        else
        {
            m_AssetBundleManifest = download.assetBundle.LoadAsset <AssetBundleManifest>(assetName);
            if (m_AssetBundleManifest == null)
            {
                ATrace.LogError(string.Format("AssetBundle Manifest load Failed"));
            }
            else
            {
            }
        }
    }
Пример #2
0
    private bool LoadAssetBundleInternal(string assetBundleName, bool fromHttp)
    {
        if (m_DownloadingWWWs.ContainsKey(assetBundleName))
        {
            return(true);
        }

        WWW    download = null;
        string url      = "";

        if (fromHttp == true)
        {
            url = AssetBundlePlatformPathManager.GetDownloadingHttpAssetBundleURL() + assetBundleName;
        }
        else
        {
            url = AssetBundlePlatformPathManager.GetAssetBundleDownloadingURL_StreamingAsset() + assetBundleName;
        }

        download = WWW.LoadFromCacheOrDownload(url, m_AssetBundleManifest.GetAssetBundleHash(assetBundleName), 0);
        m_DownloadingWWWs.Add(assetBundleName, download);
        return(false);
    }