Table of Contents

Debugging

Beginner Programmer

If your script isn't producing the expected result at runtime, you can debug it in an IDE such as Visual Studio.

Note

There are lots of ways to debug code. This page suggests one method, using Visual Studio.

  1. Open the script in Visual Studio.

    Tip

    To open your project in Visual Studio from Game Studio, in the Game Studio toolbar, click Open in IDE (Open in IDE).

  2. Press F9 to add a break point at the required places.

  3. In Visual Studio, press F5 or click Start in the toolbar to run the game in debug mode.

    Visual Studio Start button

    The game starts in a new window. In Visual Studio, on the script page, the first break point highlights and stops the execution.

  4. Verify the state of your variables.

  5. Press F10 (step over) if you want to execute the code line by line, or press F5 to continue code execution.

Note

If Visual Studio doesn't stop at the break point, make sure you attached the script to an entity in the active scene.

For more information about debugging in Visual Studio, see the MSDN documentation.

See also