Catch-Up On Mobile, Space Brands, and Crashes

Hey Folks! Today was a day for all for blog post tags. A little bit of everything, though admin work was the lion's share.

First order of business was NEO Scavenger mobile. Now that Tiago is situated in his new place and has time again, he's resuming work on mobile issues. So I spent most of the morning triaging the issue list, and helping test a display issue with hex maps.

Once that was done, I switched gears to the space prototype, where Michael had a new batch of work awaiting feedback. I think we're officially good to go on all 12 fictional brands/techs now, and the next step is getting their drafts finalized.

Finally, I had slice of time left at the end of the day to resume looking into that docking pathfinding crash bug. I haven't made much progress on it yet, though. Usually, when something crashes in Unity, I get a stack trace that points to the issue, or sometimes, a nice warning that something caused a stack overflow (infinite loop).

But in this case, the app freezes before crashing, taking Unity with it. No information at all. And my attempt to log trace the crash (image above) didn't show much yet. Pretty normal output, so the crash is happening elsewhere.

I've still got a few things to try, though, before going brute force on it. (Basically, logging every function call to see what the last line is.)


matsy's picture

If you are going to go through the effort of brute forcing I would recommend looking into implementing a system for your own trace logging to be a permanent fixture. Can be very useful when implemented. Not sure if Unity has anything around IF DEBUG, and the overheads of having it there permanently.

ra1's picture

Another approach is to create a separate thread that periodically "inspects" the main thread. The inspection thread will periodically (10-100 times a second) suspend the main thread, generate a stack trace (and log it), and then resume the main thread.

Once you've done this a few times, you hopefully have a better idea of where to add your manual logging.

The only caveat is that this can slow down the application significantly, and perhaps even prevent the exception from occurring entirely (if it is related to timing).

dcfedor's picture

@matsy, anything I trace using Debug.Log() gets written to both a separate log window and a file by Unity, so I think it's doing this already. I didn't notice any clues in that log/file, though. The log looked normal up until it ended suddenly. It's likely my logging is not granular enough to catch anything useful yet.

@ra1, that sounds very useful, but also a bit beyond my skill :)

That said, it sounds a bit like Unity's Profiling Tool, which somehow knows the call stack at each frame in order to report ms spent in each code block. The trouble I ran into using that tool is that the whole Editor crashes, taking down everything with it. So I wasn't able to inspect much.

I have a few more tricks up my sleeve, though. Two of which occurred to me in my sleep last night :)

Dan Fedor - Founder, Blue Bottle Games