【发布时间】:2015-04-14 08:43:48
【问题描述】:
我正在为 windows phone 8 导入 unity3D 项目。并添加几行代码,这些代码与 c# 代码交互到 unity3D 中 Object(SphereScript) 的事件更改处理程序。
var sphereScript = UnityEngine.Object.FindObjectOfType<SphereScript>();
sphereScript.SphereStateChanged += sphereScript_SphereStateChanged;
sphereScript_SphereStateChanged(sphereScript.IsSphereMoving);
项目编译正常,没有错误,但在手机上运行时,在线出现错误
UnityEngine.Object.FindObjectOfType<SphereScript>();
'System.Runtime.InteropServices.SEHException' 类型的异常发生在 UnityEngine.DLL 中,但未在用户代码中处理。我不知道为什么会发生这个错误。但是当我第一次启动项目时,它要求我找到文件名 UnityEngineObject.cs。我在哪里可以找到这个文件或者我该如何解决这个问题。谢谢。
完整代码的网址http://docs.unity3d.com/Manual/wp8-unity-interaction.html
【问题讨论】:
-
可以添加抛出异常的堆栈跟踪吗?
-
System.Runtime.InteropServices.SEHException 未被用户代码处理 HResult=-2147467259 消息=外部组件已引发异常。 Source=UnityEngine ErrorCode=-2147467259 StackTrace:UnityEngine.Internal.$Calli.Invoke38(Int32 arg0, IntPtr method) at UnityEngine.Object.FindObjectsOfType(Type type) at UnityEngine.Object.FindObjectOfType(Type type) at UnityEngine.Object。 UnityXamlInteractionExample.MainPage.Unity_Loaded() InnerException 处的 FindObjectOfType[T]():
标签: c# windows visual-studio windows-phone-8 unity3d