Book Image

Mastering Unity Scripting

By : Alan Thorn
Book Image

Mastering Unity Scripting

By: Alan Thorn

Overview of this book

Table of Contents (17 chapters)
Mastering Unity Scripting
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Debugging with MonoDevelop – tracepoints


Tracepoints can offer you a neater alternative to using Debug.Log statements that, as we've seen, force us to amend the code we're debugging. Tracepoints work like breakpoints, in that they mark lines within your source file. They don't change the code itself, but (unlike breakpoints) they don't pause the program execution when encountered by the debugger. Instead, they perform a specified instruction automatically. Typically, they print a debug statement to the Application Output window in MonoDevelop, though not to the Unity's Console. To set a breakpoint in line 16 of code sample 2-10, position your cursor on line 16 and select Add Tracepoint in Run from the application menu (or press Ctrl + Shift + F9), as shown here:

Adding Tracepoint to the selected line in MonoDevelop

On selecting the Add Tracepoint option, MonoDevelop will show the Add Tracepoint dialog. The Trace Text field allows you to input the text to be printed to the Application Output...