Skip to content
This repository has been archived by the owner on Dec 13, 2021. It is now read-only.

我想问下,有个资源加载的时候出现这个错误,其他资源就不会。 #24

Open
bianchengxiaobei opened this issue Nov 20, 2017 · 9 comments

Comments

@bianchengxiaobei
Copy link

AsyncUploadManager: Failed to close file archive:/CAB-020b3b51eeb82f5f87f9c0f95e001576/CAB-020b3b51eeb82f5f87f9c0f95e001576.resS. Ensure all async operations are complete before unloading bundles.是什么原因呢

@tangzx
Copy link
Owner

tangzx commented Nov 20, 2017

没遇到过,AsyncUploadManager 是你项目的代码吧

@bianchengxiaobei
Copy link
Author

好像有时候极低的概率是可以加载出来的,但是大部分是有错的。错的分两种:
有时候出现这个错误:
Assertion failed: Cancelling DisplayDialog because it was run from a thread that is not the main thread: Opening file failed Opening file archive:/CAB-020b3b51eeb82f5f87f9c0f95e001576/CAB-020b3b51eeb82f5f87f9c0f95e001576.resS: 操作成功完成。
Closing file : 操作成功完成。
: archive:/CAB-020b3b51eeb82f5f87f9c0f95e001576/CAB-020b3b51eeb82f5f87f9c0f95e001576.resS
Could not open file archive:/CAB-020b3b51eeb82f5f87f9c0f95e001576/CAB-020b3b51eeb82f5f87f9c0f95e001576.resS for read
有时候又出现这个错误:
AsyncUploadManager: Failed to close file archive:/CAB-020b3b51eeb82f5f87f9c0f95e001576/CAB-020b3b51eeb82f5f87f9c0f95e001576.resS. Ensure all async operations are complete before unloading bundles.
UnityEngine.AssetBundle:Unload(Boolean)
Tangzx.ABSystem.AssetBundleInfo:UnloadBundle() (at Assets/ABSystem/Scripts/AssetBundle/AssetBundleInfo.cs:292)
Tangzx.ABSystem.AssetBundleInfo:get_mainObject() (at Assets/ABSystem/Scripts/AssetBundle/AssetBundleInfo.cs:279)
CaomaoFramework.c__AnonStorey0:<>m__0(AssetBundleInfo) (at Assets/Scripts/Framework/UIManager/UIBase.cs:128)
AssetBundleLoader:FireEvent() (at Assets/ABSystem/Scripts/AssetBundle/AssetBundleLoader.cs:106)
AssetBundleLoader:Complete() (at Assets/ABSystem/Scripts/AssetBundle/AssetBundleLoader.cs:90)
MobileAssetBundleLoader:Complete() (at Assets/ABSystem/Scripts/AssetBundle/AssetBundleLoader.cs:285)
c__Iterator0:MoveNext() (at Assets/ABSystem/Scripts/AssetBundle/AssetBundleLoader.cs:217)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

是不是异步加载卸载造成的

@bianchengxiaobei
Copy link
Author

如果我把:
void UnloadBundle()
{
if (bundle != null)
{
if (WWWResourceManager.enableLog)
Debug.Log("Unload : " + data.compositeType + " >> " + data.debugName);

            bundle.Unload(false);
        }
        bundle = null;
    }

的bundle.Unload(false)注释了就不会有错误

@tangzx
Copy link
Owner

tangzx commented Nov 20, 2017

这个问题倒是没遇见过。Ensure all async operations are complete before unloading bundles. 重点可能在这,你有没有改ABSystem源码,或者多个ab系统共存了,导致一边在加载一边在卸载?

@bianchengxiaobei
Copy link
Author

能加个qq聊下吗,好像只有这个资源有问题。其他资源就没问题,很奇怪

@bianchengxiaobei
Copy link
Author

大佬,在吗?又有问题,就是场景加载后,加载的UI就会变形。是场景加载时会卸载AB吗,我已经将UI设置为DontDestory了,为啥还会卸载?

@li5414
Copy link

li5414 commented Dec 20, 2017

这是新版unity的问题,主要是加载ab里面的纹理,然后立即unload(false),延迟unload就行了

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@tangzx @takaaptech @li5414 @bianchengxiaobei and others