Assertion failed: Cancelling DisplayDialog because it was run from a thread that is not the main thread: Opening file failed Opening file

        我们采用的加载方式是,在LoadAsset后,调用Bundle.UnLoad(false)释放AssetBundle本身的内存占用,在一些资源加载的时候会出现下图的报错信息。

报错信息
Assertion failed: Cancelling DisplayDialog because it was run from a thread that is not the main thread: Opening file failed Opening file_第1张图片
纹理显示不正确

    我怀疑是在加载资源的信息的过程中,UnLoad报的错,注释掉后就显示正常了,也没有了报错信息。

    google了下,发现也有不少开发者遇到这个问题,不知道是Unity故意这样设计,还是Unity的bug.但是到现在,不管是在Unity2017.2还是   Unity2017.3版本都还存在这个问题。

    知道问题所在,绕过去的方法也就很明了了。

    (1)在UnLoad时,做一点延时,经测试可行。

    (2)用LoadAssetAsync 代替LoadAsset接口,在异步加载完了再UnLoad

你可能感兴趣的:(Assertion failed: Cancelling DisplayDialog because it was run from a thread that is not the main thread: Opening file failed Opening file)