Esempio n. 1
0
        protected override IEnumerator LoadFuncEnumerator()
        {
            if (m_LoadState != LoadState.WaitLoad)
            {
                yield break;
            }

            m_LoadState   = LoadState.Loading;
            m_BundleIndex = FullBundleLoader.LoadAsync(m_BundleName, null);
            var bundleLoader = FullBundleLoader.GetLoader(m_BundleIndex);

            while (!bundleLoader.IsComplate)
            {
                yield return(null);
            }

            var bundle  = bundleLoader.GetAssetBundle();
            var request = bundle.LoadAssetAsync <Object>(m_AssetName);

            while (!request.isDone)
            {
                yield return(null);
            }

            m_AssetObject = request.asset;
            m_LoadState   = LoadState.Complete;

            foreach (var action in m_LoadedCallbackDict)
            {
                var callback = action.Value;
                callback(m_AssetObject != null, m_AssetObject);
            }

            m_LoadedCallbackDict.Clear();
            TryUnLoadByAssetKey(m_AssetKeyName);
        }