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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.