首页 > 编程语言 > 详细

unity3d questions!

时间:2015-05-13 18:57:49      阅读:392      评论:0      收藏:0      [点我收藏+]

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.”

unity3d questions!

原文:http://www.cnblogs.com/jiangjieqim/p/4500861.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!