Exemple #1
0
    // 从缓存中查找AssetBundle,没有则同步加载并缓存
    public static AssetBundleRef GetAB(string assetbundleName)
    {
        AssetBundleRef abr;

        if (abDict.TryGetValue(assetbundleName, out abr))
        {
            // 缓存命中
            abr.Retain();
            return(abr);
        }
        AssetBundle ab = AssetBundleLoader.Load(assetbundleName); // 同步加载

        abr = AssetBundleManager.CacheAB(assetbundleName, ab);
        CheckShouldCacheSprite(abr);
        return(abr);
    }