iOS上的Unity崩溃 - GameObject.SendMessage

时间:2016-02-22 23:16:53

标签: c# ios exception unity3d crash

Unity版本:5.3.2p2

在执行GameObject.SendMessage()调用时,它在Unity的内部代码中崩溃,应该注意到这条特定的行本身不是崩溃的来源(这一行中没有任何内容)代码为空):

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.EventSystems;

// Attached to a large Image that blocks all input, OnPointerClick filters to a "target"
public class OnboardingArrowInputBlocker : MonoBehaviour, IPointerClickHandler
{
    public MonoBehaviour target;

    public void OnPointerClick(PointerEventData eventData)
    {
        if (target)
        {
            // Line that leads to the crash (crashes in Unity's internal code, not here):
            target.gameObject.SendMessage("OnPointerClick", eventData, SendMessageOptions.DontRequireReceiver);
        }
    }
}

我最好的猜测是,在Unity的SendMessage代码中,当它试图找到一个有效的目标来调用OnPointerClick消息时会发生异常。这意味着崩溃发生在我们调用目标上的OnPointerClick回调之前,而不是在其回调体内(因为它会显示在跟踪中)。如果它是代码中的内部问题,我似乎需要用Unity打开支持票。

如果有更多关于我的问题可以分享的信息,请告诉我。谢谢大家!

堆栈追踪:

Thread : Crashed: com.apple.main-thread
0  game-app                       0x100033770 CrashedCheckBellowForHintsWhy() (CrashReporter.mm:97)
1  game-app                       0x100cbfe10 RuntimeInvoker_Void_t2779279689_Object_t_Object_t(MethodInfo const*, void*, void**) (Il2CppInvokerTable.cpp:1128)
2  game-app                       0x101613d94 il2cpp::vm::Runtime::CallUnhandledExceptionDelegate(Il2CppDomain*, Il2CppDelegate*, Il2CppObject*) (Runtime.cpp:350)
3  game-app                       0x101613d14 il2cpp::vm::Runtime::UnhandledException(Il2CppObject*) (Runtime.cpp:433)
4  game-app                       0x100ee6ee4 ScriptingInvocation::Invoke(ScriptingException**, bool) (ScriptingInvocation.cpp:202)
5  game-app                       0x100edd0f8 MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethodIl2Cpp, ScriptingObject*, ScriptingException**) (MonoBehaviour.cpp:839)
6  game-app                       0x100edd2dc MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethodIl2Cpp, ScriptingObject*) (MonoBehaviour.cpp:859)
7  game-app                       0x100eeb920 Scripting::SendScriptingMessage(Unity::GameObject&, char const*, ScriptingObject*) (BaseObject.h:87)
8  game-app                       0x101105784 GameObject_CUSTOM_SendMessage(ReadOnlyScriptingObjectOfType<Unity::GameObject>, ICallString, ScriptingObject*, int) (UnityEngineGameObjectBindings.gen.cpp:320)
9  game-app                       0x100166628 OnboardingArrowInputBlocker_Message2dObjects_m1580627665 (Bulk_Assembly-CSharp_14.cpp:6437)
10 game-app                       0x1001660ac OnboardingArrowInputBlocker_OnPointerClick_m3735897309 (Bulk_Assembly-CSharp_14.cpp:6148)
11 game-app                       0x1009f6848 ExecuteEvents_Execute_TisObject_t_m1533897725_gshared (GenericMethods0.cpp:35043)
12 game-app                       0x1007d90e4 StandaloneInputModule_ProcessTouchPress_m2953705401 (Bulk_UnityEngine.UI_0.cpp:8133)
13 game-app                       0x1007d8d08 StandaloneInputModule_ProcessTouchEvents_m3567487943 (Bulk_UnityEngine.UI_0.cpp:7836)
14 game-app                       0x1007d8684 StandaloneInputModule_Process_m3720469665 (Bulk_UnityEngine.UI_0.cpp:7775)
15 game-app                       0x100cbfba4 RuntimeInvoker_Void_t2779279689(MethodInfo const*, void*, void**) (Il2CppInvokerTable.cpp:1072)
16 game-app                       0x1016136b0 il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppObject**) (Runtime.cpp:350)
17 game-app                       0x100ee7128 ScriptingInvocationNoArgs::Invoke(ScriptingException**) (ScriptingInvocationNoArgs.cpp:111)
18 game-app                       0x100ee70e0 ScriptingInvocationNoArgs::Invoke() (ScriptingInvocationNoArgs.cpp:95)
19 game-app                       0x100edc670 MonoBehaviour::CallUpdateMethod(int) (MonoBehaviour.cpp:456)
20 game-app                       0x100dafb38 void BaseBehaviourManager::CommonUpdate<BehaviourManager>() (Behaviour.cpp:169)
21 game-app                       0x100e97d24 PlayerLoop(bool, bool, IHookEvent*) (Player.cpp:1727)
22 game-app                       0x10110e2b0 UnityPlayerLoopImpl(bool) (LibEntryPoint.mm:239)
23 game-app                       0x10002a41c UnityRepaint (UnityAppController+Rendering.mm:236)
24 game-app                       0x10002a25c -[UnityAppController(Rendering) repaintDisplayLink] (UnityAppController+Rendering.mm:52)
25 QuartzCore                     0x186933814 CA::Display::DisplayLinkItem::dispatch() + 40
26 QuartzCore                     0x1869336c8 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 424
27 IOKit                          0x18445e1e8 IODispatchCalloutFromCFMessage + 372
28 CoreFoundation                 0x18418b1f8 __CFMachPortPerform + 180
29 CoreFoundation                 0x1841a1634 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
30 CoreFoundation                 0x1841a0d6c __CFRunLoopDoSource1 + 436
31 CoreFoundation                 0x18419eac4 __CFRunLoopRun + 1800
32 CoreFoundation                 0x1840cd680 CFRunLoopRunSpecific + 384
33 GraphicsServices               0x1855dc088 GSEventRunModal + 180
34 UIKit                          0x188f44d90 UIApplicationMain + 204
35 game-app                       0x10002455c main (main.mm:32)
36 libdyld.dylib                  0x183c6e8b8 start + 4

0 个答案:

没有答案