2020-05-18 20:25:49 +05:30 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								<?xml version="1.0" encoding="UTF-8" ?>  
						 
					
						
							
								
									
										
										
										
											2023-07-06 10:08:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								<class  name= "EditorDebuggerPlugin"  inherits= "RefCounted"  xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"  xsi:noNamespaceSchemaLocation= "../class.xsd" >  
						 
					
						
							
								
									
										
										
										
											2020-05-18 20:25:49 +05:30 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									<brief_description > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										A base class to implement debugger plugins.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									</brief_description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									<description > 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 14:30:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										[EditorDebuggerPlugin] provides functions related to the editor side of the debugger.
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 15:21:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										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:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-05-17 20:00:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											func _has_capture(capture):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												# Return true if you wish to handle messages with the prefix "my_plugin:".
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return capture == "my_plugin"
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 15:21:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-05-17 20:00:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											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
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 15:21:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-05-17 20:00:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											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)
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 15:21:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										var debugger = ExampleEditorDebugger.new()
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										func _enter_tree():
							 
						 
					
						
							
								
									
										
										
										
											2025-05-17 20:00:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											add_debugger_plugin(debugger)
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 15:21:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										func _exit_tree():
							 
						 
					
						
							
								
									
										
										
										
											2025-05-17 20:00:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											remove_debugger_plugin(debugger)
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 15:21:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										[/gdscript]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										[/codeblocks]
							 
						 
					
						
							
								
									
										
										
										
											2024-10-21 11:36:59 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										To connect on the running game side, use the [EngineDebugger] singleton:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										[codeblocks]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										[gdscript]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										extends Node
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										func _ready():
							 
						 
					
						
							
								
									
										
										
										
											2025-05-17 20:00:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EngineDebugger.register_message_capture("my_plugin", _capture)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EngineDebugger.send_message("my_plugin:ping", ["test"])
							 
						 
					
						
							
								
									
										
										
										
											2024-10-21 11:36:59 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										func _capture(message, data):
							 
						 
					
						
							
								
									
										
										
										
											2025-05-17 20:00:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											# Note that the "my_plugin:" prefix is not used here.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if message == "echo":
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												prints("Echo received:", data)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return true
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return false
							 
						 
					
						
							
								
									
										
										
										
											2024-10-21 11:36:59 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										[/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.
							 
						 
					
						
							
								
									
										
										
										
											2020-05-18 20:25:49 +05:30 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									<tutorials > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									</tutorials> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									<methods > 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-02 14:07:10 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<method  name= "_breakpoint_set_in_tree"  qualifiers= "virtual" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<param  index= "0"  name= "script"  type= "Script"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<param  index= "1"  name= "line"  type= "int"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<param  index= "2"  name= "enabled"  type= "bool"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Override this method to be notified when a breakpoint is set in the editor.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<method  name= "_breakpoints_cleared_in_tree"  qualifiers= "virtual" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Override this method to be notified when all breakpoints are cleared in the editor.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 15:21:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<method  name= "_capture"  qualifiers= "virtual" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<return  type= "bool"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 15:21:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<param  index= "0"  name= "message"  type= "String"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<param  index= "1"  name= "data"  type= "Array"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<param  index= "2"  name= "session_id"  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-18 20:25:49 +05:30 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-21 11:36:59 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												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.
							 
						 
					
						
							
								
									
										
										
										
											2020-05-18 20:25:49 +05:30 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-02 14:07:10 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<method  name= "_goto_script_line"  qualifiers= "virtual" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<param  index= "0"  name= "script"  type= "Script"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<param  index= "1"  name= "line"  type= "int"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Override this method to be notified when a breakpoint line has been clicked in the debugger breakpoint panel.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 15:21:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<method  name= "_has_capture"  qualifiers= "virtual const" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<return  type= "bool"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 15:21:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<param  index= "0"  name= "capture"  type= "String"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-18 20:25:49 +05:30 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 22:41:48 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												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.
							 
						 
					
						
							
								
									
										
										
										
											2020-05-18 20:25:49 +05:30 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 15:21:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<method  name= "_setup_session"  qualifiers= "virtual" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 15:21:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<param  index= "0"  name= "session_id"  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-18 20:25:49 +05:30 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-21 11:36:59 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Override this method to be notified whenever a new [EditorDebuggerSession] is created. Note that the session may be inactive during this stage.
							 
						 
					
						
							
								
									
										
										
										
											2020-05-18 20:25:49 +05:30 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 15:21:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<method  name= "get_session" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<return  type= "EditorDebuggerSession"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<param  index= "0"  name= "id"  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-18 20:25:49 +05:30 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 15:21:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Returns the [EditorDebuggerSession] with the given [param id].
							 
						 
					
						
							
								
									
										
										
										
											2020-05-18 20:25:49 +05:30 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 15:21:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<method  name= "get_sessions" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<return  type= "Array"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-18 20:25:49 +05:30 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 15:21:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Returns an array of [EditorDebuggerSession] currently available to this debugger plugin.
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 16:16:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												[b]Note:[/b] Sessions in the array may be inactive, check their state via [method EditorDebuggerSession.is_active].
							 
						 
					
						
							
								
									
										
										
										
											2020-05-18 20:25:49 +05:30 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									</methods> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								</class>