标签:
UnityVS: Web Target with Web Security enabled will prevent opening files and communication with UnityVS.
解决方法
直接在 unity中 File-》build setting -> 更换一个平台就行,不要选择web的
just go to File->Build Settings then select something other than web player and then press Switch Platform.
======================================================================================
捕获日志
using UnityEngine; using System.Collections; public class SetupVerification : MonoBehaviour { public string message = ""; private bool badSetup = false; void Awake () { Application.RegisterLogCallback (OnLog); } void OnLog (string message, string stacktrace, LogType type) { if (message.IndexOf ("UnityException: Input Axis") == 0 || message.IndexOf ("UnityException: Input Button") == 0 ) { //处理异常信息 } } }
===============================================================
InternalGetGameObject can only be called from the main thread.
然后socketclient对象是异步的,所以做了多线程处理,当socketclient接收到消息时,回调了主线程的函数(继承自monobehaviour),这时候就导致了报错。上面第一篇unity论坛博文解释得比较清楚,大概就是unity对于API调用主线程做了限制:
“Unity chose to limit API calls to main-thread, to make a simple and solid threading model that everyone can understand and use.”
标签:
原文地址:http://www.cnblogs.com/jiangjieqim/p/4500861.html