EditorDebuggerPlugin in Godot – Complete Guide

Welcome to today’s tutorial, where we’ll explore the powerful capabilities of the EditorDebuggerPlugin class in Godot 4. When developing games, having the right tools for debugging is crucial. Godot, being a versatile and robust game engine, offers a wealth of built-in functionalities that can greatly enhance your development workflow. Among these tools is the EditorDebuggerPlugin class, designed to provide advanced debugging support within the Godot Editor. If you’re eager to create custom debuggers or simply want to harness every advantage in your game development projects, this tutorial will shed light on an often-overlooked feature of Godot that might just revolutionize your debugging strategy.

What is EditorDebuggerPlugin?

The EditorDebuggerPlugin class in Godot 4 is a base class for implementing custom debugger plugins. These plugins are connected to the editor side of the debugging process, enabling developers to create tailored tools that fit the specific needs of their projects.

What is it for?

The purpose of such a plugin is to facilitate more intuitive interactions with the debugging process. This means you can create specialized tabs, respond to certain debug messages, and even handle custom breakpoints or outputs, all integrated into the Godot editor’s standard debugging environment.

Why Should I Learn It?

Understanding and utilizing the EditorDebuggerPlugin class amplifies your options for debugging and can make your game development process more efficient. By learning how to create and use these plugins, you’re essentially crafting a personalized debugging experience, smoothing out potential development hiccups and gaining insight into your game’s behavior from an insider’s perspective. Moreover, skills acquired from mastering this feature will be a strong addition to your Godot expertise toolkit, complementing a well-rounded game development skill set.

CTA Small Image

Getting Started with EditorDebuggerPlugin

Before diving into the code, ensure you have a Godot 4 project open. Then, let’s begin by creating a basic plugin structure:

extends EditorPlugin

var your_debugger_plugin

func _enter_tree():
    your_debugger_plugin = preload("res://path_to_your_custom_plugin.gd").new()

func _exit_tree():

This snippet establishes the foundation of our custom debugger plugin. We preload a script that will define the debugger plugin’s functionality, create a new instance of it, and add it to the list of active debugger plugins.

Defining the Custom Debugger Plugin

Next, let’s outline what our custom plugin script looks like. This script is referenced in the previous step as “path_to_your_custom_plugin.gd”:

extends EditorDebuggerPlugin

func _debugger_enter():
    print("Debugger has started.")

func _debugger_exit():
    print("Debugger has stopped.")

func _debugger_process(delta):
    print("Debugger is processing with delta: " + str(delta))

In this example, the `_debugger_enter`, `_debugger_exit`, and `_debugger_process` functions are overridden to perform simple print statements. These functions are called when the debugger starts, stops, and processes frames respectively.

Interacting with Debugger Breakpoints

Here’s an example of how to handle custom breakpoints. We’ll use the `debugger_break` callback:

extends EditorDebuggerPlugin

func _debugger_break(condition: String, file: String, line: int):
    print("Breakpoint reached in file: " + file + " at line: " + str(line) + " with condition: " + condition)

The `_debugger_break` method gets called when the debugger hits a breakpoint. Our custom plugin can now respond to this event.

Custom Debugger Interface Elements

Finally, let’s inject some user interface elements into the debugger. This allows us to extend the debugger with custom elements that may display additional information or provide new ways to interact with our game during debugging:

extends EditorDebuggerPlugin

var custom_button

func _debugger_enter():
    custom_button = Button.new()
    custom_button.text = "Custom Action"
    custom_button.connect("pressed", self, "_on_custom_button_pressed")
    add_control_to_dock(DOCK_SLOT_BOTTOM_LEFT, custom_button)

func _debugger_exit():

func _on_custom_button_pressed():
    print("Custom button pressed.")

With this snippet, we create a new button upon entering the debugger and place it in the bottom left dock. When pressed, it prints a message to the console, showcasing how we can interact with the editor’s UI directly from our debugger plugin.

Remember, these examples cover the basics of setting up and using the EditorDebuggerPlugin class to build custom debugger features. As you become more comfortable with this functionality, you’ll be able to create more complex and useful tools that integrate seamlessly with your Godot development workflow.Continuing our exploration into the Godot 4 EditorDebuggerPlugin class, let’s delve into more advanced functionalities. As game creators, having the capability to not just interact with the usual debugging process but to also visualize and manage custom game metadata in real-time can be invaluable. Here are more examples that demonstrate the breadth of customization you can achieve with EditorDebuggerPlugin.

Visualizing Custom Data Streams
Imagine you want to monitor a custom stream of data, like the player’s health or the number of enemies on screen. Here’s how you might start building that functionality:

extends EditorDebuggerPlugin

var custom_data_label

func _debugger_enter():
    custom_data_label = Label.new()
    add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, custom_data_label)

func _debugger_process(delta):
    var player_health = get_custom_debug_value("player_health")
    custom_data_label.text = "Player Health: " + str(player_health)

This creates a label that updates every frame with the player’s health. The `get_custom_debug_value` is a hypothetical function you would have implemented to interface with game-specific data.

Handling Editor Debugger Inspections
Let’s integrate custom inspections that can happen during the debug phase:

extends EditorDebuggerPlugin

func handle_debug_inspector(object):
    if object.has_method("get_debug_data"):
        var debug_data = object.get_debug_data()
        # Process and display debug data as needed
        for key in debug_data.keys():
            print(key + ": " + var2str(debug_data[key]))

Assuming that the game objects implement a `get_debug_data` method, you can call this to retrieve and display custom debug information.

Custom Play/Pause/Stop Buttons
What if you want to add custom play, pause, and stop functionality?

extends EditorDebuggerPlugin

var play_button, pause_button, stop_button

func _debugger_enter():
    play_button = Button.new()
    pause_button = Button.new()
    stop_button = Button.new()
    play_button.text = "Play"
    pause_button.text = "Pause"
    stop_button.text = "Stop"
    # Assume `_on_play_button_pressed` and other callbacks are defined
    play_button.connect("pressed", self, "_on_play_button_pressed")
    pause_button.connect("pressed", self, "_on_pause_button_pressed")
    stop_button.connect("pressed", self, "_on_stop_button_pressed")

func _on_play_button_pressed():

func _on_pause_button_pressed():

func _on_stop_button_pressed():

In this snippet, we’re adding controls that call Godot’s editor functionality, influencing the game state from our custom debugger.

Custom Debugger Notifications
It can also be useful to tie into Godot’s robust notification system for custom debugger notifications.

extends EditorDebuggerPlugin

func _notification(what):
        print("Debugger Plugin has entered the scene tree.")

        print("Debugger Plugin has exited the scene tree.")

    # Other custom notifications can be added here as needed.

Debugger plugins can respond to the usual lifecycle notifications, enabling you to set up or tear down resources at the appropriate times.

Conclusion and Next Steps
The examples provided here are just a taste of what can be accomplished with the EditorDebuggerPlugin class in Godot 4. Whether it’s for tailoring the user interface, creating custom data visualizations, or extending the core functionalities of the debugger, the possibilities are extensive.

As you delve into creating advanced plugins, remember to consider performance and the non-obstructiveness of your tools. Debugger plugins should enhance your development process without becoming a hindrance themselves. Always test your plugins thoroughly to ensure they work harmoniously with the rest of the Godot Editor and your game’s debugging needs.

Harnessing the true power of the Godot EditorDebuggerPlugin class can be a grand leap in leveling up your development workflow. We encourage you to experiment with the provided examples, modify them to fit your project’s needs, and further explore the rich capabilities Godot offers for game development. Happy debugging!Continuing with our exploration into advanced functionalities of the Godot 4 EditorDebuggerPlugin class, let’s delve into more specific features that can significantly aid in debugging complex game behavior.

Custom Breakpoint Conditions
You might want to set conditional breakpoints that only trigger under certain game conditions, like when a player’s score exceeds a specific value. Here’s how to set up a conditional breakpoint:

extends EditorDebuggerPlugin

var last_score = 0

func _debugger_process(delta):
    var current_score = get_custom_debug_value("current_score")
    if current_score > last_score and current_score > 1000:
        push_editor_breakpoint("You scored over 1000!", true)
    last_score = current_score

This allows you to write custom conditions for breakpoints based on the game data, enhancing your control over the debugging process.

Custom Debugger Commands
Integrating custom commands into the debugger allows you to execute specific functions inside the running game. Here are commands that could reset a level or spawn an item:

extends EditorDebuggerPlugin

func _debugger_command(command: String, args: Array):
    match command:
            spawn_game_item(args[0], args[1].to_vector2())
            print("Unknown command: " + command)

By sending custom debugger commands, we can invoke `reset_current_level` or `spawn_game_item` methods we’ve previously created in our game code.

Modifying the Editor Interface
Debugger plugins can also add new docks or tabs to the editor, providing a space for display or interaction:

extends EditorDebuggerPlugin

var custom_dock

func _debugger_enter():
    custom_dock = Control.new()
    add_control_to_dock(DOCK_SLOT_LEFT_UM, custom_dock)
    custom_dock.name = "My Custom Dock"

func _debugger_exit():

With this setup, we create a custom dock that could host a variety of interface elements, and we make sure to clean it up when the debugger exits.

Custom EditorInspector Plugins
Sometimes your game objects might require complex custom inspectors for editing. You can create these inspectors within your debugger plugin:

extends EditorDebuggerPlugin

func _has_main_screen():
    return true

func _make_custom_inspectors():
    # Assume a PlayerInspectorPlugin has already been defined elsewhere
    var player_inspector_plugin = PlayerInspectorPlugin.new()

Here, we define that our debugger plugin has a main screen and we also instantiate and add a custom inspector plugin for players in our game.

Subclassing for Custom Debugger Windows
If you need to design a full-fledged window within the debugger, subclassing is your go-to:

extends EditorDebuggerPlugin

class CustomDebuggerWindow extends WindowDialog:
    func _ready():
        set_title("Custom Debugger Window")
        # Additional setup

var window

func _debugger_enter():
    window = CustomDebuggerWindow.new()

func _debugger_exit():

In this example, we create a subclass `CustomDebuggerWindow`, which when the debugger is entered, we then instantiate, add to the scene, and present to the user.

Creating Debugger Overlays
For visual debugging tools, like displaying hitboxes or paths, overlays can be created:

extends EditorDebuggerPlugin

var overlay_control

func _debugger_enter():
    overlay_control = Control.new()
    # Setup overlay_control for drawing
    add_control_to_container(CONTAINER_CANVAS_EDITOR_MENU, overlay_control)

func _draw_overlay():
    # Drawing methods such as draw_rect, draw_circle, etc.

func _debugger_process(delta):
    overlay_control.update() # Triggers redraw

func _debugger_exit():

This code sample demonstrates how we could create and manage an overlay for debugging visual elements in realtime. The `_draw_overlay` would contain our custom drawing code.

Through these examples, it’s evident that the EditorDebuggerPlugin class provides vast opportunities for creating deeply integrated and powerful debugging tools. These features not only streamline the debugging process but also allow for a higher level of customization and control over how you test and refine your game. As with any advanced feature, mastery comes with practice and experimentation, so we encourage you to take these snippets as inspiration and apply them to your own Godot development projects.

Where to Go Next in Your Game Development Journey

Congratulations on furthering your knowledge of the Godot engine! Mastering advanced features like the EditorDebuggerPlugin class can seem daunting at first, but remember that every expert was once a beginner. To continue honing your skills and to embark on an even more comprehensive learning path, we invite you to explore our Godot Game Development Mini-Degree. This extensive program covers a variety of essential topics, ranging from 2D and 3D game creation to mastering GDScript, that will equip you with the know-how to bring your game ideas to life.

Deepen Your Godot Skills with Zenva’s Courses

At Zenva, we understand the value of well-structured, project-based learning. Our Godot Game Development Mini-Degree is perfect for those starting their journey in game development as well as seasoned developers looking to sharpen their skills in new areas. With a curriculum designed to take you through six comprehensive levels of game development, you’ll be able to craft incredible games from the ground up, learning at your own pace with the flexibility of our online courses.

For a broader learning experience, we encourage you to explore all our Godot courses, where each one is filled with valuable content to support your growth as a developer. Whether you’re just starting out or looking to professionalize your skillset, our courses will guide you through the journey from beginner to confidently creating your own games. Take the next step today and continue your adventure in game development with Zenva!


Your foray into the versatile world of Godot is just beginning. With the skills you’ve learned here and the myriad of resources available in the Godot Game Development Mini-Degree, you are well on your way to becoming a proficient game developer. Remember, every game you admire started as a simple idea, which blossomed through the developer’s perseverance and continuous learning. So, keep pushing your creative boundaries, refine your technical skills, and let your passion for game development be your guide.

At Zenva, we’re passionate about empowering you with the knowledge and practical skills needed to create your very own video games. We’re excited to witness the incredible games you’ll build and the innovative ideas you’ll bring to the gaming community. Don’t stop now; the finish line is a series of milestones, and your next big achievement in game development awaits. Join us on this continuous journey of education, creation, and most importantly, fun!

Python Blog Image

FINAL DAYS: Unlock coding courses in Unity, Godot, Unreal, Python and more.