Documentation
¶
Overview ¶
Package EditorDebuggerPlugin provides methods for working with EditorDebuggerPlugin object instances.
Index ¶
- type Advanced
- type Any
- type Implementation
- type Instance
- func (self Instance) AsEditorDebuggerPlugin() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) GetSession(id int) [1]gdclass.EditorDebuggerSession
- func (self Instance) GetSessions() []any
- func (self *Instance) UnsafePointer() unsafe.Pointer
- func (self Instance) Virtual(name string) reflect.Value
- type Interface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Implementation ¶
type Implementation = implementation
Implementation implements Interface with empty methods.
type Instance ¶
type Instance [1]gdclass.EditorDebuggerPlugin
[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 [method EditorPlugin.add_debugger_plugin]. Once added, the [method _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 [EditorDebuggerSession]s via [method get_sessions] or get a specific one via [method get_session]. [codeblocks] [gdscript] @tool extends EditorPlugin
class ExampleEditorDebugger extends EditorDebuggerPlugin:
func _has_capture(capture): # Return true if you wish to handle messages with the prefix "my_plugin:". return capture == "my_plugin" func _capture(message, data, session_id): if message == "my_plugin:ping": get_session(session_id).send_message("my_plugin:echo", data) return true return false 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" # Will be used as the tab title. 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")) session.add_session_tab(label)
var debugger = ExampleEditorDebugger.new()
func _enter_tree():
add_debugger_plugin(debugger)
func _exit_tree():
remove_debugger_plugin(debugger)
[/gdscript] [/codeblocks] To connect on the running game side, use the [EngineDebugger] singleton: [codeblocks] [gdscript] extends Node
func _ready():
EngineDebugger.register_message_capture("my_plugin", _capture) EngineDebugger.send_message("my_plugin:ping", ["test"])
func _capture(message, data):
# Note that the "my_plugin:" prefix is not used here. if message == "echo": prints("Echo received:", data) return true return false
[/gdscript] [/codeblocks] [b]Note:[/b] While the game is running, [method @GlobalScope.print] and similar functions [i]called in the editor[/i] do not print anything, the Output Log prints only game messages.
See [Interface] for methods that can be overridden by a [Class] that extends it.
%!(EXTRA string=EditorDebuggerPlugin)
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsEditorDebuggerPlugin ¶
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) GetSession ¶
func (self Instance) GetSession(id int) [1]gdclass.EditorDebuggerSession
Returns the [EditorDebuggerSession] with the given [param id].
func (Instance) GetSessions ¶
Returns an array of [EditorDebuggerSession] currently available to this debugger plugin. [b]Note:[/b] Sessions in the array may be inactive, check their state via [method EditorDebuggerSession.is_active].
func (*Instance) UnsafePointer ¶
type Interface ¶
type Interface interface { //Override this method to be notified whenever a new [EditorDebuggerSession] is created. Note that the session may be inactive during this stage. SetupSession(session_id int) //Override this method to enable receiving messages from the debugger. If [param capture] is "my_message" then messages starting with "my_message:" will be passed to the [method _capture] method. HasCapture(capture string) bool //Override this method to process incoming messages. The [param session_id] is the ID of the [EditorDebuggerSession] that received the [param message]. Use [method get_session] to retrieve the session. This method should return [code]true[/code] if the message is recognized. Capture(message string, data []any, session_id int) bool //Override this method to be notified when a breakpoint line has been clicked in the debugger breakpoint panel. GotoScriptLine(script [1]gdclass.Script, line int) //Override this method to be notified when all breakpoints are cleared in the editor. BreakpointsClearedInTree() //Override this method to be notified when a breakpoint is set in the editor. BreakpointSetInTree(script [1]gdclass.Script, line int, enabled bool) }