O'Reilly logo

Mastering Unity 2017 Game Development with C# - Second Edition by Alan Thorn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Debug cleaning

Here's a great tip for cleaning your project and code of debug statements! We all use the print and Debug.Log functions to print debug messages to the console to validate our code and its execution. However, it's easy to add many debug statements, eventually spamming the console with many. Furthermore, when the time comes to build our game, we normally want to remove all debug statements to prevent our application from running code that isn't effective anymore. For example, consider the following statement:

Debug.Log("Hello World");

This code prints the following message to the console, which can be seen from the Unity editor, but not in a standalone build:

Printing debug messages

It can be tedious having to remove every ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required