Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.


Inherits: RefCounted < Object

A base class to implement debugger plugins.


EditorDebuggerPlugin provides functions related to the editor side of the debugger.

To interact with the debugger, an instance of this class must be added to the editor via EditorPlugin.add_debugger_plugin.

Once added, the _setup_session callback will be called for every EditorDebuggerSession available to the plugin, and when new ones are created (the sessions may be inactive during this stage).

You can retrieve the available EditorDebuggerSessions via get_sessions or get a specific one via get_session.

extends EditorPlugin

class ExampleEditorDebugger extends EditorDebuggerPlugin:

    func _has_capture(prefix):
        # Return true if you wish to handle message with this prefix.
        return prefix == "my_plugin"

    func _capture(message, data, session_id):
        if message == "my_plugin:ping":
            get_session(session_id).send_message("my_plugin:echo", data)

    func _setup_session(session_id):
        # Add a new tab in the debugger session UI containing a label.
        var label = Label.new()
        label.name = "Example plugin"
        label.text = "Example plugin"
        var session = get_session(session_id)
        # Listens to the session started and stopped signals.
        session.started.connect(func (): print("Session started"))
        session.stopped.connect(func (): print("Session stopped"))