Edit

Share via


Debug Unreal Engine Blueprints in Visual Studio

Visual Studio improves debugging Unreal Engine projects by showing information about Unreal Engine Blueprints in the call stack and local variables windows. This feature lets you debug Blueprint code alongside your C++ code in a one debugging session. With this functionality, you can easily track interactions between Blueprints and C++ code, making it simpler to identify and fix bugs.

Blueprints are a visual scripting technology available in Unreal Engine for rapid prototyping and development. They can interact with C++ code and in many cases games are originally designed as Blueprints and later converted to C++ to improve performance. If you spend time converting Blueprints to C++, this functionality lets you analyze Blueprints together with C++ code to help with the conversion. This reduces the need to switch between Visual Studio and the Unreal Editor, providing a seamless debugging experience and reducing context-switching.

Visual Studio Blueprint debugger support provides:

  • Integrated call stack: Blueprint frames appear in the same call stack as C++ frames.
  • Variable inspection: View Blueprint node pins and their values appear in the local variables window.
  • Unified debugging experience: Debug Blueprint and C++ code in the same session.
  • Breakpoint support: Set breakpoints in C++ code called by Blueprints. This is useful when you have multiple Blueprints that can call C++ code, but you aren't sure which ones do and why.

Prerequisites

  • Visual Studio 2022 17.14 or later with the Game development with C++ workload installed.
  • Visual Studio debugger tools for Unreal Engine Blueprints component.
  • Visual Studio Tools for Unreal Engine component.
  • Unreal Engine plugin for Visual Studio.
  • Unreal Engine installed with debug symbols.
  • Visual Studio plugin for Unreal Engine.

Install prerequisites

Run the Visual Studio Installer to install the required components to debug Unreal Engine Blueprints. For more information about installing Visual Studio Tools for Unreal Engine, see Get started with Visual Studio Tools for Unreal Engine.

  • On the Workloads pane, make sure the Game development with C++ workload is installed, along with Visual Studio debugger tools for Unreal Engine Blueprints and Visual Studio Tools for Unreal Engine:

    Screenshot of the Visual Studio installer. The Game development with C++ workload is selected. In the installation details pane, Visual Studio Tools for Unreal Engine, Visual Studio debugger tools for Unreal Engine Blueprints, HSL Tools, And Windows 11 SDK are selected.

Install Unreal Engine debug symbols

Install debug symbols for each version of Unreal Engine you debug with Visual Studio:

  1. Open the Epic Games Launcher.

  2. Select the Unreal Engine pane and then the Library pane.

  3. Select the dropdown menu for your engine version, then choose Options:

    Screenshot of the Epic Games installer. The Launch dropdown is selected and Options is highlighted.

  4. In the options dialog, select Editor symbols for debugging:

    Screenshot of the Epic Games installation options. Editor symbols for debugging is selected.

  5. Select Apply, then wait for the download to finish.

Install Unreal Engine plugin for Visual Studio

The Unreal Engine plugin for Visual Studio installs into Unreal Engine. It's automatically activated when you open an Unreal Engine project in Visual Studio. This plugin provides the necessary integration between Unreal Engine and Visual Studio to view Blueprint node pin values in the Visual Studio debugger local variables window.

For manual installation instructions, see vc-ue-extensions.

If you have an Unreal Engine project that you can open in Visual Studio, another way to install the plugin is in Visual Studio via the Unreal Engine Configuration window:

  • With an Unreal Engine project opened in Visual Studio, choose Project > Configure Tools for Unreal Engine to open the Unreal Engine Integration Configuration window.
  • In the Visual Studio Integration Tool Status section, select Install to Project or Install to Engine as meets your needs.

If you don't see the install buttons, choose the refresh icon to refresh the status. If you need to install the plugin manually, select the Manual installation instructions link to open the vc-ue-extensions page, which contains installation instructions.

Screenshot of the Unreal Engine Integration Configuration window. In the Visual Studio Integration Tool Status section, the refresh, Install to Project, and Install to Engine buttons are highlighted. The Manual installation instructions link is also highlighted.

Set up a test project

To test the Blueprint debugger functionality, create a project that contains Blueprints and C++ code. The Unreal Engine First Person template works well.

  1. Open the Unreal Engine Editor and create a new First Person project.

  2. Ensure that C++ is selected:

    Screenshot of the Unreal Engine editor new project dialog. First Person is selected, and the BlueEpic Games installation options. Editor symbols for debugging is selected.

  3. After creating the project, close all Unreal Editor instances.

  4. In Visual Studio, open the generated Visual Studio solution file (.sln).

Install Visual Studio plugin for Unreal Engine

To support viewing node pin variables for Blueprints in the Visual Studio debugger, you also need to install the Visual Studio plugin for Unreal Engine. The plugin can be installed in either the Engine or Game project sources. It's automatically activated when an Unreal Engine project is opened in Visual Studio. For installation instructions, see vc-ue-extensions.

Debug Blueprints

Follow these steps to set a breakpoint, inspect a Blueprint function, and view its node pin values:

  1. In Visual Studio, locate the AttachWeapon method in the weapon component class. For example, if you named your project FirstPerson, the function would be in the file FirstPersonWeaponComponent.cpp.

  2. Add a breakpoint at the start of the AttachWeapon method. This method is called when the player picks up a weapon in the game:

    Screenshot of the AttachWeapon function in Visual Studio. A breakpoint is on the first line of the function.

  3. In the Visual Studio Solution Configuration dropdown, select Development Editor:

    Screenshot of the Visual Studio solution configuration dropdown. Development Editor is selected.

  4. In Visual Studio, compile and run the project to open the Unreal Editor.

  5. In the Unreal Editor, select the green Play button to start the game.

  6. In the running game, press the W key to move forward until you collide with the weapon and trigger the breakpoint.

  7. When the breakpoint is hit, examine the Call stack window. Blueprint stack frames appear among your C++ stack frames:

    Screenshot of the call stack window in Visual Studio. The breakpoint in AttachWeapon is at the top of the call stack. Two Blueprint entries are highlighted in the call stack for BP_PickUp_Rifle::ExecuteUbergraph_BP_PickUp_Rifle and BP_PickUp_Rifle::BndEvt___BP_PickUp_Rifle_TP_PickUp_K2Node_ComponentBoundEvent_1_OnPickUp_DelegateSignature.

  8. Double-click the first Blueprint frame in the call stack.

  9. Open the Locals window to view the variables associated with the Blueprint node. You can see the values of the Blueprint node pins:

    Screenshot of the locals window in Visual Studio. Blueprint information > Node Pins > Available pins is expanded to show the values of the Blueprint such as the EntryPoint, PickUpCharacter, HasRifle, and more.

Summary

The Visual Studio Blueprint debugger provides a seamless debugging experience that bridges the gap between C++ and Blueprint code in Unreal Engine projects. This integrated approach allows you to:

  • Track execution flow from C++ to Blueprints and back.
  • Inspect Blueprint variables, node pin values, and C++ variables.
  • Step through Blueprint execution frames in the same debugging session as C++ code.

This unified debugging experience helps resolve issues efficiently across both coding paradigms, eliminating the need to switch between different debugging tools.