O'Reilly logo

Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation by James A. Henley, Matthew Johnson

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

Using Breakpoints to Halt Code Execution

There are times when you’re going to want to closely examine the code during runtime and Debug() won’t cut it. In these situations, we can attach MonoDevelop directly to the Unity process and step through code execution by using breakpoints.

Breakpoints cause the code to halt when they’re encountered. You can then use MonoDevelop to step through the code, one line at a time, to see where it goes and what it does. You can also monitor the values of variables while doing this, making it an excellent way to catch and resolve unexpected behaviors in your game.

We’re going to introduce one such behavior into our game and then use the debugger to catch it. Start by altering the PlayerController script to match ...

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