Some errors can be handled and some cannot. Nevertheless, it’s extremely common to see codebases chock-full of ineffective error handling for these unrecoverable issues. The result is a lot of extra code to write, maintain, and test that often serves to make debugging harder. Today’s article shows you how to make debugging internal errors so much easier by effectively writing code to handle them.
Posts Tagged logging
Sometimes it seems like Unity programming is a minefield. Plenty of innocuous-looking code secretly creates garbage and eventually the GC runs and causes a frame hitch. Today’s article is about some of those less-obvious ways to create garbage.
One of the great advantages of programming in Unity is that it uses a (mostly) standard .NET implementation. This means you can find lots of third party code that is written for .NET but not necessarily Unity and still incorporate it into your app. This kind of code typically uses System.Console.Write
or System.Console.WriteLine
to print to standard output, but Unity doesn’t display it in its Console panel or redirect it to platform-specific logging like Android’s logcat
. This article provides a class you can easily integrate into your app to redirect System.Console
writes to Unity’s standard Debug
logging so it’ll show up like you’d expect.
There are other test harnesses out there, but today I thought I’d share one of my own.