Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

EngineDebugger

繼承: Object

暴露內部除錯器。

說明

EngineDebugger 處理編輯器與正在運作的遊戲之間的通信。它會在運作遊戲時啟動,可以通過它收發訊息,還負責管理效能分析器。

方法

void

clear_breakpoints()

void

debug(can_continue: bool = true, is_error_breakpoint: bool = false)

int

get_depth() const

int

get_lines_left() const

bool

has_capture(name: StringName)

bool

has_profiler(name: StringName)

void

insert_breakpoint(line: int, source: StringName)

bool

is_active()

bool

is_breakpoint(line: int, source: StringName) const

bool

is_profiling(name: StringName)

bool

is_skipping_breakpoints() const

void

line_poll()

void

profiler_add_frame_data(name: StringName, data: Array)

void

profiler_enable(name: StringName, enable: bool, arguments: Array = [])

void

register_message_capture(name: StringName, callable: Callable)

void

register_profiler(name: StringName, profiler: EngineProfiler)

void

remove_breakpoint(line: int, source: StringName)

void

script_debug(language: ScriptLanguage, can_continue: bool = true, is_error_breakpoint: bool = false)

void

send_message(message: String, data: Array)

void

set_depth(depth: int)

void

set_lines_left(lines: int)

void

unregister_message_capture(name: StringName)

void

unregister_profiler(name: StringName)


方法說明

void clear_breakpoints() 🔗

清除所有斷點。


void debug(can_continue: bool = true, is_error_breakpoint: bool = false) 🔗

在執行腳本時觸發除錯中斷,可以使用 can_continue 指定程式是否能夠繼續執行,還可以指定該中斷是否是由斷點導致的。


int get_depth() const 🔗

實驗性: 此方法可能在未來版本中變更或移除。

回傳目前除錯深度。


int get_lines_left() const 🔗

實驗性: 此方法可能在未來版本中變更或移除。

回傳剩餘的行數。


bool has_capture(name: StringName) 🔗

如果存在具有給定名稱的捕獲,則返回 true,否則返回 false。


bool has_profiler(name: StringName) 🔗

如果存在具有給定名稱的分析器,則返回 true,否則返回 false。


void insert_breakpoint(line: int, source: StringName) 🔗

使用給定的 source 和 line 插入一個新斷點。


bool is_active() 🔗

如果除錯器處於活動狀態,則返回 true,否則返回 false。


bool is_breakpoint(line: int, source: StringName) const 🔗

如果給定的 source 和 line 代表一個已存在的斷點,則回傳 true。


bool is_profiling(name: StringName) 🔗

如果存在具有給定名稱的分析器,並且該分析器處於活動狀態,則返回 true,否則返回 false。


bool is_skipping_breakpoints() const 🔗

如果除錯器跳過斷點,則回傳 true,否則回傳 false。


void line_poll() 🔗

強制除錯器事件的一個處理循環。該方法的目的是當腳本可能過於繁忙時不時地處理事件,以便可以捕獲無限循環之類的錯誤。


void profiler_add_frame_data(name: StringName, data: Array) 🔗

使用給定的 name 和 data 呼叫分析器中的 add 可調用體。


void profiler_enable(name: StringName, enable: bool, arguments: Array = []) 🔗

使用給定的 name 和 arguments 呼叫分析器中的 toggle 可呼叫體。會根據 enable 參數啟用/停用同一分析器。


void register_message_capture(name: StringName, callable: Callable) 🔗

使用名稱 name 注冊訊息捕獲。如果 name 為“my_message”則會為“my_message:”開頭的訊息呼叫給定的可呼叫體。

可呼叫體必須接受訊息字串和資料陣列參數。如果能夠識別該訊息,則可呼叫體應回傳 true。

注意:可呼叫體收到的訊息已剝離前綴,這一點與 EditorDebuggerPlugin._capture() 不同。範例見 EditorDebuggerPlugin 的描述。


void register_profiler(name: StringName, profiler: EngineProfiler) 🔗

使用給定的名稱 name 註冊分析器。詳情見 EngineProfiler。


void remove_breakpoint(line: int, source: StringName) 🔗

使用給定的 source 和 line 移除一個斷點。


void script_debug(language: ScriptLanguage, can_continue: bool = true, is_error_breakpoint: bool = false) 🔗

在執行腳本時觸發除錯中斷,可以使用 can_continue 指定程式是否能夠繼續執行,還可以指定該中斷是否是由斷點導致的。


void send_message(message: String, data: Array) 🔗

發送訊息,內容為給定的 message 和 data 陣列。


void set_depth(depth: int) 🔗

實驗性: 此方法可能在未來版本中變更或移除。

設定目前除錯深度。


void set_lines_left(lines: int) 🔗

實驗性: 此方法可能在未來版本中變更或移除。

設定目前剩餘的除錯行。


void unregister_message_capture(name: StringName) 🔗

將具有給定名稱 name 的訊息捕獲解除註冊。


void unregister_profiler(name: StringName) 🔗

將具有給定名稱 name 的分析器解除註冊。