|
I have a scene that runs fine in the editor . . . well, almost fine; my camera isn't moving the way I thought I had scripted it. So, I would like to debug it. But if I put a breakpoint in the code while it's running, it crashes the Unity Editor. If I put the add the breakpoint before I hit play, the scene just freezes and never starts. Does anybody know why this might be happening? One of my MonoBehaviours is multi-threaded; is that a problem?
(comments are locked)
|
|
First, you can't use multithreaded MonoBehaviours. Unity's scripting engine runs on a single thread. You can use threads but you can't call any Unity api from another thread. I don't debug that much with MonoDevelop (I use Visual Studio for coding). As far as i know it's the normal behaviour that the editor freezes when you break the execution. You have to continue the execution after you're done with debugging. That's how most debuggers work. The debugged application will be interruped at your breakpoint and will freeze until you continue the application. Thanks, I hadn't realized we couldn't have multithreaded MonoBehaviours, but when I went back to my code, the other thread doesn't make any Unity api calls . . . so I should be fine, right? Oh, and I'm sorry, what I said before was confusing. Unity is not stopping on my break points. It never gets there because it freezes at the very beginning.
May 13 '11 at 05:11 PM
burns
Well, it's very important if you use your own threads to catch ALL exceptions within your thread. If an exception fall-through to Unity (player, editor) it will mostly crash. That's at least what i figured out the hard way ;) I'm not sure if the debugger can handle those extra threads but i guess it should work.
May 13 '11 at 06:00 PM
Bunny83
(comments are locked)
|
