跳至正文
版本:bleeding-edge 🩸

🐛 调试

调试工具:脚本性能分析以及在世界中绘制调试形状。

🗿Static ClassClient & Server🧑‍💻API Source

🗿 静态函数​

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

Moderate

DrawBox​

在世界中绘制一个调试方块
Debug.DrawBox(location, extent, rotation, color, life_time?, thickness?)

Parameters

TypeParameterDefaultDescription
Vectorlocation Required parameter 世界位置
Vectorextent Required parameter 方块在各个轴向上的半尺寸
Rotatorrotation Required parameter 世界旋转
Colorcolor Required parameter 使用的颜色
floatlife_time?5
绘制消失前的秒数
floatthickness?0
线条粗细

Moderate

DrawCapsule​

在世界中绘制一个调试胶囊体
Debug.DrawCapsule(center, half_height, radius, rotation, color?, life_time?, thickness?)

Parameters

TypeParameterDefaultDescription
Vectorcenter Required parameter 胶囊体的中心
floathalf_height Required parameter 胶囊体高度的一半
floatradius Required parameter 胶囊体的半径
Rotatorrotation Required parameter 胶囊体的旋转
Colorcolor?Color.RED
使用的颜色
floatlife_time?5
调试绘制消失前的秒数
floatthickness?0
线条粗细

Moderate

DrawCoordinateSystem​

在世界中绘制一个调试坐标系
Debug.DrawCoordinateSystem(location, rotation, size?, life_time?, thickness?)

Parameters

TypeParameterDefaultDescription
Vectorlocation Required parameter 世界位置
Rotatorrotation Required parameter 世界旋转
floatsize?100
绘制的尺寸
floatlife_time?5
绘制消失前的秒数
floatthickness?0
线条粗细

Moderate

DrawCrosshairs​

在世界中绘制一个调试准星
Debug.DrawCrosshairs(location, rotation, size?, color?, life_time?, thickness?)

Parameters

TypeParameterDefaultDescription
Vectorlocation Required parameter 世界位置
Rotatorrotation Required parameter 世界旋转
floatsize?100
绘制的尺寸
Colorcolor?Color.RED
使用的颜色
floatlife_time?5
绘制消失前的秒数
floatthickness?0
线条粗细

Moderate

DrawCylinder​

在世界中绘制一个调试圆柱体
Debug.DrawCylinder(start_location, end_location, radius, segments, color?, life_time?, thickness?)

Parameters

TypeParameterDefaultDescription
Vectorstart_location Required parameter 世界起始位置
Vectorend_location Required parameter 世界结束位置
floatradius Required parameter 半径
integersegments Required parameter 用于绘制圆柱体的分段数量,分段越多外观越平滑
Colorcolor?Color.RED
使用的颜色
floatlife_time?5
绘制消失前的秒数
floatthickness?0
线条粗细

Moderate

DrawDirectionalArrow​

在世界中绘制一个调试方向箭头
Debug.DrawDirectionalArrow(start_location, end_location, arrow_size?, color?, life_time?, thickness?)

Parameters

TypeParameterDefaultDescription
Vectorstart_location Required parameter 世界起始位置
Vectorend_location Required parameter 世界结束位置
floatarrow_size?100
箭头头部的大小
Colorcolor?Color.RED
使用的颜色
floatlife_time?5
绘制消失前的秒数
floatthickness?0
线条粗细

Moderate

DrawLine​

在世界中绘制一条调试线条
Debug.DrawLine(start_position, end_position, color?, life_time?, thickness?)

Parameters

TypeParameterDefaultDescription
Vectorstart_position Required parameter 世界起始位置
Vectorend_position Required parameter 世界结束位置
Colorcolor?Color.RED
使用的颜色
floatlife_time?5
绘制消失前的秒数
floatthickness?0
线条粗细

Moderate

DrawPoint​

在世界中绘制一个调试点
Debug.DrawPoint(start_position, color?, life_time?, size?)

Parameters

TypeParameterDefaultDescription
Vectorstart_position Required parameter 世界起始位置
Colorcolor?Color.RED
使用的颜色
floatlife_time?5
绘制消失前的秒数
floatsize?10
绘制的尺寸

Moderate

DrawSphere​

在世界中绘制一个调试球体
Debug.DrawSphere(start_location, radius, segments, color?, life_time?, thickness?)

Parameters

TypeParameterDefaultDescription
Vectorstart_location Required parameter 世界起始位置
floatradius Required parameter 半径
integersegments Required parameter 用于绘制圆柱体的分段数量,分段越多外观越平滑
Colorcolor?Color.RED
使用的颜色
floatlife_time?5
绘制消失前的秒数
floatthickness?0
线条粗细

Moderate

DrawString​

在世界中绘制一段调试字符串
Debug.DrawString(location, text, color?, life_time?, draw_shadow?, font_scale?)

Parameters

TypeParameterDefaultDescription
Vectorlocation Required parameter 世界位置
stringtext Required parameter 要绘制的文本
Colorcolor?Color.RED
使用的颜色
floatlife_time?5
绘制消失前的秒数
booleandraw_shadow?false
是否在文本下方绘制阴影
floatfont_scale?1
文本的缩放比例

Optimal

IsProfilerConnected​

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

Returns

TypeDescription
booleanTracy 是否已连接

Optimal

ProfileMessage​

在 Tracy 时间线上用文本标记一个事件。

文本会带有“[package]”前缀。Tracy 未连接时不执行任何操作。
Debug.ProfileMessage(text)

Parameters

TypeParameterDefaultDescription
stringtext Required parameter 事件文本

Optimal

ProfilePlot​

在 Tracy 的图表中记录一个值。

图表名称会带有“[package]”前缀。使用固定名称:每个不同的名称都会一直存储到游戏或服务器关闭,最多总共 256 个名称。Tracy 未连接时不执行任何操作。
Debug.ProfilePlot(name, value)

Parameters

TypeParameterDefaultDescription
stringname Required parameter 图表名称
numbervalue Required parameter 要记录的值

Optimal

ProfileZone​

运行一个函数,并将其作为区域在 Tracy 和原生性能分析中进行测量。

区域名称会带有“[package]”前缀,并在函数返回时始终关闭。

使用固定名称:每个不同的名称都会一直存储到游戏或服务器关闭,最多总共 256 个名称。
Debug.ProfileZone(name, callback)

Parameters

TypeParameterDefaultDescription
stringname Required parameter 区域名称
functioncallback Required parameter 要运行和测量的函数

🚀 事件​

This class doesn't have own events.