🐛 调试
调试工具:脚本性能分析以及在世界中绘制调试形状。
🗿 静态函数
| Returns | Name | Description | |
|---|---|---|---|
DrawBox | 在世界中绘制一个调试方块 | ||
DrawCapsule | 在世界中绘制一个调试胶囊体 | ||
DrawCoordinateSystem | 在世界中绘制一个调试坐标系 | ||
DrawCrosshairs | 在世界中绘制一个调试准星 | ||
DrawCylinder | 在世界中绘制一个调试圆柱体 | ||
DrawDirectionalArrow | 在世界中绘制一个调试方向箭头 | ||
DrawLine | 在世界中绘制一条调试线条 | ||
DrawPoint | 在世界中绘制一个调试点 | ||
DrawSphere | 在世界中绘制一个调试球体 | ||
DrawString | 在世界中绘制一段调试字符串 | ||
| boolean | IsProfilerConnected | 返回当前是否连接了 Tracy 性能分析器。可用于跳过调试逻辑 | |
ProfileMessage | 在 Tracy 时间线上用文本标记一个事件 | ||
ProfilePlot | 在 Tracy 的图表中记录一个值 | ||
ProfileZone | 运行一个函数,并将其作为区域在 Tracy 和原生性能分析中进行测量 |
Moderate

DrawBox
在世界中绘制一个调试方块
Debug.DrawBox(location, extent, rotation, color, life_time?, thickness?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | location | Required parameter | 世界位置 |
| Vector | extent | Required parameter | 方块在各个轴向上的半尺寸 |
| Rotator | rotation | Required parameter | 世界旋转 |
| Color | color | Required parameter | 使用的颜色 |
| float | life_time? | 5 | 绘制消失前的秒数 |
| float | thickness? | 0 | 线条粗细 |
Moderate

DrawCapsule
在世界中绘制一个调试胶囊体
Debug.DrawCapsule(center, half_height, radius, rotation, color?, life_time?, thickness?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | center | Required parameter | 胶囊体的中心 |
| float | half_height | Required parameter | 胶囊体高度的一半 |
| float | radius | Required parameter | 胶囊体的半径 |
| Rotator | rotation | Required parameter | 胶囊体的旋转 |
| Color | color? | Color.RED | 使用的颜色 |
| float | life_time? | 5 | 调试绘制消失前的秒数 |
| float | thickness? | 0 | 线条粗细 |
Moderate

DrawCoordinateSystem
在世界中绘制一个调试坐标系
Debug.DrawCoordinateSystem(location, rotation, size?, life_time?, thickness?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | location | Required parameter | 世界位置 |
| Rotator | rotation | Required parameter | 世界旋转 |
| float | size? | 100 | 绘制的尺寸 |
| float | life_time? | 5 | 绘制消失前的秒数 |
| float | thickness? | 0 | 线条粗细 |
Moderate

DrawCrosshairs
在世界中绘制一个调试准星
Debug.DrawCrosshairs(location, rotation, size?, color?, life_time?, thickness?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | location | Required parameter | 世界位置 |
| Rotator | rotation | Required parameter | 世界旋转 |
| float | size? | 100 | 绘制的尺寸 |
| Color | color? | Color.RED | 使用的颜色 |
| float | life_time? | 5 | 绘制消失前的秒数 |
| float | thickness? | 0 | 线条粗细 |
Moderate

DrawCylinder
在世界中绘制一个调试圆柱体
Debug.DrawCylinder(start_location, end_location, radius, segments, color?, life_time?, thickness?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | start_location | Required parameter | 世界起始位置 |
| Vector | end_location | Required parameter | 世界结束位置 |
| float | radius | Required parameter | 半径 |
| integer | segments | Required parameter | 用于绘制圆柱体的分段数量,分段越多外观越平滑 |
| Color | color? | Color.RED | 使用的颜色 |
| float | life_time? | 5 | 绘制消失前的秒数 |
| float | thickness? | 0 | 线条粗细 |
Moderate

DrawDirectionalArrow
在世界中绘制一个调试方向箭头
Debug.DrawDirectionalArrow(start_location, end_location, arrow_size?, color?, life_time?, thickness?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | start_location | Required parameter | 世界起始位置 |
| Vector | end_location | Required parameter | 世界结束位置 |
| float | arrow_size? | 100 | 箭头头部的大小 |
| Color | color? | Color.RED | 使用的颜色 |
| float | life_time? | 5 | 绘制消失前的秒数 |
| float | thickness? | 0 | 线条粗细 |
Moderate

DrawLine
在世界中绘制一条调试线条
Debug.DrawLine(start_position, end_position, color?, life_time?, thickness?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | start_position | Required parameter | 世界起始位置 |
| Vector | end_position | Required parameter | 世界结束位置 |
| Color | color? | Color.RED | 使用的颜色 |
| float | life_time? | 5 | 绘制消失前的秒数 |
| float | thickness? | 0 | 线条粗细 |
Moderate

DrawPoint
在世界中绘制一个调试点
Debug.DrawPoint(start_position, color?, life_time?, size?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | start_position | Required parameter | 世界起始位置 |
| Color | color? | Color.RED | 使用的颜色 |
| float | life_time? | 5 | 绘制消失前的秒数 |
| float | size? | 10 | 绘制的尺寸 |
Moderate

DrawSphere
在世界中绘制一个调试球体
Debug.DrawSphere(start_location, radius, segments, color?, life_time?, thickness?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | start_location | Required parameter | 世界起始位置 |
| float | radius | Required parameter | 半径 |
| integer | segments | Required parameter | 用于绘制圆柱体的分段数量,分段越多外观越平滑 |
| Color | color? | Color.RED | 使用的颜色 |
| float | life_time? | 5 | 绘制消失前的秒数 |
| float | thickness? | 0 | 线条粗细 |
Moderate

DrawString
在世界中绘制一段调试字符串
Debug.DrawString(location, text, color?, life_time?, draw_shadow?, font_scale?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | location | Required parameter | 世界位置 |
| string | text | Required parameter | 要绘制的文本 |
| Color | color? | Color.RED | 使用的颜色 |
| float | life_time? | 5 | 绘制消失前的秒数 |
| boolean | draw_shadow? | false | 是否在文本下方绘制阴影 |
| float | font_scale? | 1 | 文本的缩放比例 |
Optimal

IsProfilerConnected
返回当前是否连接了 Tracy 性能分析器。可用于跳过调试逻辑
local ret = Debug.IsProfilerConnected()
Returns
| Type | Description |
|---|---|
| boolean | Tracy 是否已连接 |
Optimal

ProfileMessage
在 Tracy 时间线上用文本标记一个事件。
文本会带有“[package]”前缀。Tracy 未连接时不执行任何操作。
Debug.ProfileMessage(text)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | text | Required parameter | 事件文本 |
Optimal

ProfilePlot
在 Tracy 的图表中记录一个值。
图表名称会带有“[package]”前缀。使用固定名称:每个不同的名称都会一直存储到游戏或服务器关闭,最多总共 256 个名称。Tracy 未连接时不执行任何操作。
Debug.ProfilePlot(name, value)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | name | Required parameter | 图表名称 |
| number | value | Required parameter | 要记录的值 |
Optimal

ProfileZone
运行一个函数,并将其作为区域在 Tracy 和原生性能分析中进行测量。
区域名称会带有“[package]”前缀,并在函数返回时始终关闭。
使用固定名称:每个不同的名称都会一直存储到游戏或服务器关闭,最多总共 256 个名称。
Debug.ProfileZone(name, callback)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | name | Required parameter | 区域名称 |
| function | callback | Required parameter | 要运行和测量的函数 |
🚀 事件
This class doesn't have own events.

