Quantcast
Channel: Questions in topic: "xcode"
Viewing all articles
Browse latest Browse all 1047

OnCollisionEnter causes crash

$
0
0
Hello! The device should vibrate when I hit a wall, but when I hit one the game crashes. It doesn't crash if I comment out the OnCollisionEnter method, but it does crash if I only comment out if (Wall.gameObject.tag == "Wall") { if (PlayerPrefs.GetInt ("VibrateIsOn") == 1) { Handheld.Vibrate(); } Commenting out this didn't help either: collision = true; So only when I comment out the whole OnCollisionEnter -method it doesn't crash **THIS IS THE FULL SCRIPT:** using UnityEngine; using System.Collections; public class CollisionTrigger : MonoBehaviour { public GameObject Wall; public static bool collision = false; void Start () { collision = false; } void OnCollisionEnter () { if (Wall.gameObject.tag == "Wall") { if (PlayerPrefs.GetInt ("VibrateIsOn") == 1) { Handheld.Vibrate(); } collision = true; } } } Crash log: * thread #1: tid = 0x1519, 0x01049608 mazeracing`il2cpp::metadata::ArrayMetadata::GetBoundedArrayClass(TypeInfo*, unsigned int, bool) [inlined] il2cpp::metadata::SZArrayClassHash::operator(arrayClass=0x00000000)(TypeInfo const*) const at ArrayMetadata.cpp:379, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x28) * frame #0: 0x01049608 mazeracing`il2cpp::metadata::ArrayMetadata::GetBoundedArrayClass(TypeInfo*, unsigned int, bool) [inlined] il2cpp::metadata::SZArrayClassHash::operator(arrayClass=0x00000000)(TypeInfo const*) const at ArrayMetadata.cpp:379 frame #1: 0x01049608 mazeracing`il2cpp::metadata::ArrayMetadata::GetBoundedArrayClass(TypeInfo*, unsigned int, bool) [inlined] std::__1::__unordered_map_hasher, il2cpp::metadata::SZArrayClassHash, true>::operator(__x=0x00000000)(TypeInfo* const&) const at unordered_map:384 frame #2: 0x01049608 mazeracing`il2cpp::metadata::ArrayMetadata::GetBoundedArrayClass(TypeInfo*, unsigned int, bool) [inlined] std::__1::__hash_iterator, void*>*> std::__1::__hash_table, std::__1::__unordered_map_hasher, il2cpp::metadata::SZArrayClassHash, true>, std::__1::__unordered_map_equal, il2cpp::metadata::SZArrayClassCompare, true>, std::__1::allocator>>::find(__k=0x00000000) at __hash_table:2020 frame #3: 0x01049608 mazeracing`il2cpp::metadata::ArrayMetadata::GetBoundedArrayClass(TypeInfo*, unsigned int, bool) [inlined] std::__1::unordered_map>>::find(this=, __k=0x00000000) at unordered_map:968 frame #4: 0x01049608 mazeracing`il2cpp::metadata::ArrayMetadata::GetBoundedArrayClass(elementClass=0x00000000, rank=1, bounded=false) + 168 at ArrayMetadata.cpp:459 frame #5: 0x01055648 mazeracing`il2cpp::vm::Array::New(elementTypeInfo=, length=) + 12 at Array.cpp:50 frame #6: 0x00968c0c mazeracing`ConvertContactToMono [inlined] CreateScriptingArray + 132 at ScriptingExportUtility.h:16 frame #7: 0x00968c08 mazeracing`ConvertContactToMono + 128 at MessageParameters.cpp:29 frame #8: 0x009aba96 mazeracing`HandleNotifications [inlined] Arguments + 248 at MonoBehaviour.cpp:1207 frame #9: 0x009ab99e mazeracing`HandleNotifications + 362 at MonoBehaviour.cpp:1276 frame #10: 0x00847b48 mazeracing`SendMessageAny [inlined] HandleMessage + 96 at MessageHandler.h:91 frame #11: 0x00847b3e mazeracing`SendMessageAny + 86 at GameObject.cpp:1185 frame #12: 0x00a849ee mazeracing`ProcessContacts [inlined] GetOtherRigidbodyOrCollider + 154 at GameObject.h:483 frame #13: 0x00a849d8 mazeracing`ProcessContacts + 132 at PhysicsManager.cpp:2435 frame #14: 0x00a83a42 mazeracing`ProcessRecordedReports + 30 at PhysicsManager.cpp:2489 frame #15: 0x00a8395a mazeracing`FixedUpdate + 1386 at PhysicsManager.cpp:1408 frame #16: 0x0096aa98 mazeracing`PlayerLoop + 896 at Player.cpp:1804 frame #17: 0x007b69d2 mazeracing`UnityPlayerLoopImpl + 14 at LibEntryPoint.mm:236 frame #18: 0x0005f7d8 mazeracing`UnityRepaint + 432 at UnityAppController+Rendering.mm:246 frame #19: 0x0005f590 mazeracing`__51-[UnityAppController(.block_descriptor=0x15d0d690) repaintDisplayLink]_block_invoke + 56 at UnityAppController+Rendering.mm:52 frame #20: 0x02f6019a libdispatch.dylib`_dispatch_call_block_and_release + 10 frame #21: 0x02f60186 libdispatch.dylib`_dispatch_client_callout + 22 frame #22: 0x02f63e9c libdispatch.dylib`_dispatch_main_queue_callback_4CF + 1504 frame #23: 0x24b5b888 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8 frame #24: 0x24b59fa8 CoreFoundation`__CFRunLoopRun + 1512 frame #25: 0x24aa59a0 CoreFoundation`CFRunLoopRunSpecific + 476 frame #26: 0x24aa57b2 CoreFoundation`CFRunLoopRunInMode + 106 frame #27: 0x2c4671a8 GraphicsServices`GSEventRunModal + 136 frame #28: 0x28256634 UIKit`UIApplicationMain + 1440 frame #29: 0x000554c4 mazeracing`main(argc=, argv=) + 260 at main.mm:40 (lldb)

Viewing all articles
Browse latest Browse all 1047

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>