Our iOS project is no longer able to run, and we’re unsure as to what the issue might be. We have the same problem on multiple machines. We are both running XCode 4.5.2 and 3.5.6f4. The game runs fine in the editor or JIT, but AOT-compiled code for iOS causes the game to crash as soon as it attempts to initialize any monobehaviour.
Here is the stack trace from XCode:
And here’s me handtyping it out:
mono_runtime_invoke
mono_runtime_object_init_exception
MonoBehaviour::RebuildMonoInstance
MonoBehaviour::SetScript
void MonoBehaviour::VirtualRedirectTransfer
SerializedFile::ReadObject
PersistentManager::LoadFileCompletely
PreloadLevelOperation::Perform
PreloadManager::Run
PreloadManager::Run(void *)
Thread::RunThreadWrapper()
Our current theory is that there is a bug in the AOT compiler that is causing the initialization of the MonoBehaviour to throw a null exception. This occurs with any monobehaviour in our (large) project. By removing all 2400 C# files from the project and putting a test C# behaviour in a scene we do not get the error.
Has anyone seen something like this? Any thoughts on how to fix this would be much appreciated!
One of the things we’re looking at, too, is how to set up AOT without having to compile for the device. Is it possible to compile AOT on the desktop or the editor?
Its been a week and this is still an issue. Anyone have an idea? Unity, this is stopping production on our entire team! We REALLY need help with this.
When you have such a critical issue you usually send a message to support@unity3d.com ( http://unity3d.com/company/contact ).
The forum is not monitored in the same way and it’s mostly supported by Unity users, not devs. Same goes for Unity answers. Basically if you are looking for an opinion, a guide or various solutions to a Unity problem the forum and the answers system is the way to go. For problems like the one you mention you need to contact
support.
Thanks Koyima, I have emailed Unity. Hopefully they can help.
Please send me your support ticket number. And to solve issue faster please submit your project as bug report.
Thanks
Hi Mantas, thanks for getting involved. My current ticket number is #00112373 (which really just points to this thread).
Unfortunately the size of the project is prohibitive to send as a bug report (>3GB). Any way I can send it to you by other means? We also have legal implications that make that difficult but I’m chatting with my boss to see what is possible. We have hundreds of thousands of lines of code, and its closed source and highly sensitive. I’m currently actively working at getting something that would be a test project that replicates this issue without any identifiable project information.
Thanks again,
Chris Hill
Hello, I upgraded my project to Unity 3.5 to 4.0.1, this change it breaks when loading a scene that instantiates several objects. In xcode shows this error:

Any suggestion or solution?
Hi Cristiano, this seems unrelated to the issues I was having with code complexity. What that looks like to me is that you have a null value or array of keyframes in an animation of some sort. I would recommend seeing if the issue still occurs with an empty scene. If it doesn’t, you can try adding the items with animations to the scene until you find the item which has the problem.
Your crash is happening while loading animations of the scene. Have you tried your project on Unity 4.1.2?