当前位置:   article > 正文

Unity报错记录大全_load can only be called from the main thread

load can only be called from the main thread

1Resource.load不能在分线程加载资源,报错以下

Load can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
UnityEngine.Resources:Load(String)
JoinManager:LoadingModel(String, String) (at Assets/Script/JoinManager.cs:36)
Message:InitRequest(String) (at Assets/Script/Message.cs:86)
Message:ReadMessage() (at Assets/Script/Message.cs:49)
Client:ReceiveCallBack(IAsyncResult) (at Assets/Script/Client.cs:89)
System.Net.Sockets.Worker:Receive()
报这个错误就是说明,加载资源不能在分线程加载,因为我在做网络模块的时候是采取异步接收数据的,所以我在异步接收数据的同时就启用加载,所以报错了,只要使用别的方法,让他在主线程加载资源就可以了

2Destroy删除本体

Destroying assets is not permitted to avoid data loss.
If you really want to remove an asset use DestroyImmediate (theObject, true);
UnityEngine.Object:Destroy(Object)
JoinManager:Update() (at Assets/Script/JoinManager.cs:75)

这个错误就是创建一个克隆体,然后不进行名字更改,就会报这个错误,因为你删除的是本体,所以克隆出来的时候呀对模型进行改名字,然后删除的时候,要使用名字查找的方式去删除

3开发AR,识别模型后,模型出现的纯色块问题

这种色块的原因是由于光照的实时渲染,无法快速补偿贴图导致纯色块,所以只要关闭自动生成贴图即可

 

未完待续....................

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/566405
推荐阅读
相关标签
  

闽ICP备14008679号