예제 #1
0
        IEnumerator OnLoadAsset(string abname, string assetName, LuaFunction func)
        {
            AssetBundleManifestOperation requestManifest = ResourceManager.Initialize(assetDir);

            if (requestManifest != null)
            {
                yield return(StartCoroutine(requestManifest));
            }

            // Load asset from assetBundle.
            string abName = abname.ToLower() + assetExt;
            //LogUtil.Log(string.Format("LoadAssetBundle:{0}", abName));
            AssetBundleAssetOperation request = ResourceManager.LoadAssetAsync(abName, assetName, typeof(UnityEngine.Object));

            if (request == null)
            {
                yield break;
            }
            yield return(StartCoroutine(request));

            // Get the asset.
            UnityEngine.Object prefab = request.GetAsset <UnityEngine.Object>();
            if (func != null)
            {
                func.call(prefab);
                func.Dispose();
                func = null;
            }
        }
예제 #2
0
        // Load AssetBundleManifest.
        static public AssetBundleManifestOperation Initialize(string manifestAssetBundleName)
        {
            LoadAssetBundle(manifestAssetBundleName, true);
            var operation = new AssetBundleManifestOperation(manifestAssetBundleName, "AssetBundleManifest", typeof(AssetBundleManifest));

            m_InProgressOperations.Add(operation);
            return(operation);
        }