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.
Posts Tagged logging
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.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.