示例#1
0
        private AsyncBundleCreateRequest HintCreateBundleAsync(AssetBundleHint hint)
        {
            var request = AssetBundle.LoadFromFileAsync(hint.bundlePath);

            var bundleRequest = new AsyncBundleCreateRequest();

            bundleRequest.createRequest = request;
            bundleRequest.hint          = hint;

            for (int i = 0, count = hint.dependenceList.Count; i < count; i++)
            {
                var depHint = hint.dependenceList[i];
                if (depHint.bundle == null)
                {
                    bundleRequest.dependenceRequestList.Add(HintCreateBundleAsync(depHint));
                }
            }

            return(bundleRequest);
        }
示例#2
0
        private void DealAsyncBundleCreateRequest(AsyncBundleCreateRequest request)
        {
            var createRequest = request;
            var hint          = createRequest.hint;
            var assetbundle   = createRequest.createRequest.assetBundle;

            if (hint.bundle == null)
            {
                hint.bundle = assetbundle;
            }
            else
            {
                assetbundle.Unload(true);
            }
            int depCount = createRequest.dependenceRequestList.Count;

            for (int i = 0; i < depCount; i++)
            {
                DealAsyncBundleCreateRequest(createRequest.dependenceRequestList[i]);
            }
        }