예제 #1
0
    //System.Diagnostics.Stopwatch sw = new Stopwatch();
    //sw.Start();
    IEnumerator LoadMainAsset()
    {
        var asyn = AssetBundle.LoadFromFileAsync(AssetResources.GetAssetPath(BundleName));

        yield return(asyn.assetBundle);

        var assetsReq = asyn.assetBundle.LoadAllAssetsAsync();

        yield return(assetsReq);

        AssetResources.RemoveFinishedLoader(this, BundleName, assetsReq.allAssets, asyn.assetBundle);
        Pool.SP.Recycle(this);
    }
예제 #2
0
    private static void LoadImediately(string bundleName)
    {
        var dependencies = AssetResources.Manifest.GetDirectDependencies(bundleName);

        if (dependencies.Length > 0)
        {
            for (int i = dependencies.Length - 1; i >= 0; i--)
            {
                LoadImediately(dependencies[i]);
            }
        }
        if (!BundleNameAssets.ContainsKey(bundleName))
        {
            var bundle = AssetBundle.LoadFromFile(AssetResources.GetAssetPath(bundleName));
            var assets = bundle.LoadAllAssets();
            InsertAssetToMap(bundleName, assets, bundle);
        }
    }