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 ...

Get Mastering Unity 2017 Game Development with C# - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.