Game Development Reference
In-Depth Information
Figure B.2
Variable watch in Visual Studio.
There are also two automatic watch windows in Visual Studio: Locals and Autos.
Locals refers to any variables that are active in the current scope. If you're inside
a class in C# or C++, one of the local variables is always going to be the
this
pointer. The Autos watch list is a bit more restrictive, and only includes variables
that are actively being processed by the lines of code relatively close to the current
one.
One important thing to note is that all types of watches will work in a “Debug”
build, but may not work in a “Release” build, depending on the language. That's
because a Release build is optimized, and one of the optimizations is to remove
any information that the debugger uses to track variables. This is especially no-
ticeable in C++, which has aggressive optimization routines in Release.
For AAA games, a common issue is that the Debug build is literally unplayable. If
you have a game that's pushing a system to the brink, it's not uncommon to have a
Debugbuildrunatlessthan5FPS,whichreallydoesn'tallowforeffectivetesting.