unity3d questions!

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

时间: 2025-01-22 22:48:53

unity3d questions!的相关文章

[Unity3D]引擎崩溃、异常、警告、BUG与提示总结及解决方法

1.U3D经常莫名奇妙崩溃.   一般是由于空异常造成的,多多检查自己的引用是否空指针. 2.编码切换警告提示.   警告提示:Some are Mac OS X (UNIX) and some are Windows. This might lead to incorrect line numbers in stacktraces and compiler errors. Many text editors can fix this using Convert Line Endings men

Unity3D中的Coroutine详解

Unity中的coroutine是通过yield expression;来实现的.官方脚本中到处会看到这样的代码. 疑问: yield是什么? Coroutine是什么? unity的coroutine程序执行流程怎么那么奇怪? unity中的coroutine原理是什么,怎么实现的? 使用unity的coroutine需要注意什么问题? 一.yield的在几种语言中的程序执行特性: Lua中的yield是使得协同函数运行->挂起并且传递参数给resume.resume使得协同函数挂起->运行

Unity3D研究院编辑器之不实例化Prefab获取删除更新组件(十五)

http://www.xuanyusong.com/archives/3727 感谢楼下的牛逼回复更正一下,我表示我也是才知道.. 其实不需要实例化也能查找,你依然直接用GetComponentsInChildren<>(true),对传true即可...这样搞还很麻烦...唯一关注是能否把Missing的脚本序列化找出来?? 使用 GetComponentsInChildren<>(true) 可以直接把Project视图里的子对象找出来!!!! return; 代码是这样的 1

Unity3D用户手册

Welcome to Unity. 欢迎使用Unity. Unity is made to empower users to create the best interactive entertainment or multimedia experience that they can. This manual is designed to help you learn how to use Unity, from basic to advanced techniques. It can be

Unity3d报告奇怪的错误CompareBaseObjectsInternal can only be called from the main thread.

其中使用了该项目.NET的Async Socket代码.后来不知道什么时候这个奇怪的错误的出现: CompareBaseObjectsInternal 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 con

UNITY3d在移动设备上的一些优化实战(一)-概述

项目进入了中期之后,就需要对程序在移动设备上的表现做分析评估和针对性的优化了,首先前期做优化,很多瓶颈没表现出来,能做的东西不多,而且很多指标会凭预想,如果太后期做优化又会太晚,到时发现一些问题改起来返工量就有太大.前一阵子花了大量时间从 cpu gpu 内存 启动时间 到发热量对项目做了一翻大规模的体检和优化,效果还是显著的,在这里做个笔记,以后开发项目时可以作为经验和提前关注 1.项目情况:笔者所在项目是一个非常重度的手游,甚至开始就是瞄着端游做的,3D世界,2.5D视角,RPG,即使战斗,

使用git对unity3d项目进行版本控制

http://stackoverflow.com/questions/18225126/how-to-use-git-for-unity-source-control The following is an excerpt from my personal blog. Using Git with 3D Games Update Oct 2015: GitHub has since released a plugin for Git called Git LFS that directly de

iOS编译Unity3d文件报错 Permission denied

最近在尝试Unity3d的使用,毕竟Unity可以很好的编译出iOS代码,只用我们正常进行打包就好了. 这里遇到了个问题,分享一下. Archive快结束的时候,报了三个错误,类似于 /Users/sciyonSoft/Library/Developer/Xcode/DerivedData/Unity-iPhone-ghjhxtadvpljitbubdnbjvnxumck/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-

【Unity3D/C#】Unity3D中的Coroutine详解

Unity中的coroutine是通过yield expression;来实现的.官方脚本中到处会看到这样的代码. 疑问: yield是什么? Coroutine是什么? unity的coroutine程序执行流程怎么那么奇怪? unity中的coroutine原理是什么,怎么实现的? 使用unity的coroutine需要注意什么问题? 一.yield的在几种语言中的程序执行特性: Lua中的yield是使得协同函数运行->挂起并且传递参数给resume.resume使得协同函数挂起->运行