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

Get Mastering Unity Scripting 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.