(解决方案在最下面啊)Assertion failed: Cancelling DisplayDialog because it was run from a thread tha..

Unity2017.3.0f3

输出日志:

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

D:/Game/EatGit/archive:/CAB-565b8f99473e03ec1fce31af4c436508/CAB-565b8f99473e03ec1fce31af4c436508.resS: 文件名、目录名或卷标语法不正确。

在Unity遇到这个问题,我是这样遇到的

1、创建一个UI,给他创建Open,Opening,Close,Closing4个动画

2、把相应的东西打包成AssetBundle

3、运行程序解包打开面板执行对应的动画,

//=====================

修正一下,这个问题可能是因为Unity的Assetbundle API表面是一个同步API,实际上底层用了异步加载,所以我在调用加载后简单的Unload,导致一些Prefab依赖的包还没使用就被关闭了,所以出现这个错误。

//=====================

两种方法,1、用异步加载的API  。2、用同步加载,然后通过协程延迟几帧Unload

猜你喜欢

转载自blog.csdn.net/qq_30858573/article/details/79318467