I’m a big fan of debugging in Unity, but sometimes there are errors that only occur when an app is run from a mobile device. For me, debugging something like a nulRef exception on an iDevice can be a huge pain. Maybe I’m just doing it wrong.
What’s the most effective way for getting relevant and useful data about a crash from a device? The crash logs often give little to no information on which component / variable / line threw the exception.
Ok, allow me to be more specific then. When running on an iphone I get the following error. It only happens on the device, never in the editor.
Program received signal: “EXC_BAD_ACCESS”.
Xcode could not locate source file: RakNetTypes.h (line: 320)
Previous frame inner to this frame (gdb could not unwind past this frame)
Previous frame inner to this frame (gdb could not unwind past this frame)
(gdb)
How can I tell which script / line / variable threw this error? There really has to be a better way of locating the source of an error than putting Debug.Log statements between every line of code to see what the last one completed was.
For me, the Unity Remote trick always works when trying to get the exact line in code that triggers the error.
Try to replicate the exception using Unity Remote. This should return the null ref exception. When you double click on the error message, your script editor should point the exact line that causes the pain in the butt ;D
Mattimus,
you can extract script name and method from Xcode stack traces. Detailed instruction how to do that are provided in Unity Manual iOS Troubleshooting section : Unity - Manual: Troubleshooting