RunService
属性
int LogicFPS |
|---|
| 逻辑帧数 |
int UpdateFPS |
|---|
| 上传帧 |
成员函数
| 当前的环境是否运行在客户端上 |
| 当前的环境是否运行在服务器上 |
| 当前的环境是否运行在studio上 |
| 当前的环境是否运行在手机端上 |
| 当前的环境是否运行在电脑端上 |
| 当前的环境是否远程环境 |
| 当前运行环境是否为Edit(编辑)模式 |
| 当前运行环境是否为Running模式 |
void Pause () |
|---|
| 如果游戏在运行则暂停游戏的模拟,暂停物理运算和脚本 |
void BindToRenderStep () |
|---|
| 绑定RenderStep事件的Lua函数。RenderPriority为当前游戏内渲染层级,可根据需要进行插入 |
void UnbindFromRenderStep () |
|---|
| 解除绑定RenderStep事件的Lua函数 |
| 获取当前时间戳,精确到毫秒。不随本地时间修改而改变。9位 |
void SetAutoTick () |
|---|
| 设置自动tick间隙 |
bool IsAutoTick () |
|---|
| 是否自动tick |
void DriveTick () |
|---|
| 驱动tick |
| 每秒获取帧数 |
void SetFramePerSecond () |
|---|
| 设置每秒帧数值 |
| 获取游戏端版本号 |
| 获取游戏平台名称 |
| 获取游戏运行平台具体的名称 |
| 函数 |
| 解除绑定Tick事件的Lua函数 |
| 函数 |
| 解除绑定Render事件的Lua函数 |
| 获取当前地图ID |
| 获取当前地图更新时间(上传时间) |
事件
| 心跳事件 |
| 渲染步幅事件,每次Update触发RenderStepped事件 |
SBXSignal Stepped () |
|---|
| 步幅事件,每次Tick触发Stepped事件 |
SBXSignal SystemStepped () |
|---|
| 步幅事件,每次系统Tick触发SystemStepped事件 |
代码示例
lua
local runService = game:GetService("RunService")
local versionStr = runService:GetMiniGameVersion() --获取沙盒游戏版本号
print("Sandbox version ="..versionStr)