Mobile Developer Checklist
Crashes
Checklist for crashes
- Disable code stripping (and set “slow with exceptions” for iOS)
- Follow the instructions on Optimizing the Size of the Built iOSApple’s mobile operating system. More info
See in Glossary Player (iphone-playerSizeOptimization) to make sure your game does not crash with stripping on iOS.
- Verify it is not because of out of memory (restart your device, use the device with maximum RAM for the platform, be sure to watch the logs)
Editor.log - on the editor
The Debug messages, warnings and errors all go to the console. Also Unity prints status reports to the console - loading assets, initializing mono, graphics driver info.
If you are trying to understand what is going on look at the editor.log. Here you will get the full picture, not just a console fragment. You can try to understand what’s happening, and watch the full log of your coding session. This will help you track down what has caused Unity crash to crash or find out what’s wrong with your assets.
Unity prints some things on the devices as well; Logcat console for Android and Xcode gdb console on iOS devices
Debugging on Android
- Use the DDMS or ADB tool
- Watch the stacktrace (Android 3 or newer). Either use c++filt (part of the ndk) or the other methods, like: http://slush.warosu.org/c++filtjs to decode the mangled function calls
- Look at the .so file that the crash occurs on:
-
libunity.so - the crash is in the Unity code or the user code
-
libdvm.so - the crash is in the Java world, somewhere with Dalvik. So find Dalvik’s stacktrace, look at your JNI code or anything Java-related (including your possible changes to the AndroidManifest.xml).
-
libmono.so - either a Mono bug or you’re doing something Mono strongly dislikes
- If the crashlog does not help you can disassemble it to get a rough understanding of what has happened.
- use ARM EABI tools from the Android NDK like this: objdump.exe -S libmono.so >> out.txt
- Look at the code around pc from the stacktrace.
- try to match that code within the fresh out.txt file.
- Scroll up to understand what is happening in the function it occurs in.
Debugging on iOS
Xcode has built in tools. Xcode 4 has a really nice GUI for debugging crashes, Xcode 3 has less.
Full gdb stack - thread backtrace all
Enable soft-null-check:
Enable development buildA development build includes debug symbols and enables the Profiler. More info
See in Glossary and script debugging. Now uncaught null ref exceptions will be printed to the Xcode console with the appropriate managed call stack.
Try turning the “fast script call” and code stripping off. It may stop some random crashes, like those caused by using some rare .Net functions or reflection.
Strategy
- Try to figure out which script the crash happens in and debug it using mono develop on the device.
- If the crash seems to not be in your code, take a closer look at the stacktrace, there should be a hint of something happening. Take a copy and submit it, and we’ll take a look.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Is something described here not working as you expect it to? It might be a Known Issue. Please check with the Issue Tracker at issuetracker.unity3d.com.
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thanks for helping to make the Unity documentation better!
Mobile Developer Checklist