コード例 #1
0
        protected override void LoadAssetInternal(string guid, Action onLoadCompleteCallback)
        {
            if (IsAssetLoaded(guid))
            {
                onLoadCompleteCallback?.Invoke();
                return;
            }

            //Use the manifest to pull the url
            AssetBundleLoader request = AssetBundleLoader.FromGuid(guid);

            if (request == null)
            {
                return;
            }

            request.OnCompleteLoading += asset =>
            {
                AssetBundleLoader assetBundleLoader = asset as AssetBundleLoader;
                Object            assetBundle       = assetBundleLoader?.AssetObject;
                if (assetBundle == null)
                {
                    return;
                }

                UnityEngine.Debug.Log("adding asset " + assetBundleLoader.AssetName + " guid" + guid);

                AddAsset(guid, assetBundle);

                onLoadCompleteCallback();
            };

            AssetManager.Instance.RequestAssetLoad(request);
        }