Exemple #1
0
    public IEnumerator PreloadWithPreloadList()
    {
        var preloadBundleNames = loader.GetWholeBundleNames();
        var preloadList        = new PreloadList("PreloadWithPreloadList", preloadBundleNames);

        var doneCount = 0;

        yield return(assetBundlePreloader.Preload(
                         loader,
                         preloadList,
                         (willLoadBundleNames, proceed, cancel) =>
        {
            proceed();
        },
                         progress =>
        {
            doneCount++;
        },
                         () =>
        {
            // do nothng.
        },
                         (code, reason, autoyaStatus) =>
        {
            Debug.LogError("failed to download, code:" + code + " reason:" + reason);
        },
                         (preloadFailedAssetBundleName, code, reason, autoyaStatus) =>
        {
            Debug.LogError("failed to download, name:" + preloadFailedAssetBundleName + " code:" + code);
        }
                         ));

        WaitUntil(() => doneCount == preloadBundleNames.Length, () => { throw new TimeoutException("not yet done. doneCount:" + doneCount); });
    }