跳转至

Engine

继承

Object

简要描述

访问基本的引擎属性。

描述

使用Engine单例,您可以查询和修改项目的运行时参数,例如每秒帧数,时间范围等。

成员

类型 属性名 默认值
bool editor_hint true
int iterations_per_second 60
float physics_jitter_fix 0.5
int target_fps 0
float time_scale 1.0

方法

返回值类型 方法名称
Dictionary get_author_info() const
Array get_copyright_info() const
Dictionary get_donor_info() const
int get_frames_drawn()
float get_frames_per_second() const
int get_idle_frames() const
Dictionary get_license_info() const
String get_license_text() const
MainLoop get_main_loop() const
int get_physics_frames() const
float get_physics_interpolation_fraction() const
Object get_singleton(name: String) const
Dictionary get_version_info() const
bool has_singleton(name: String) const
bool is_in_physics_frame() const

常量

成员说明

  • bool editor_hint
Default true
setter set_editor_hint(value)
getter is_editor_hint
  • int iterations_per_second
Default 60
setter set_iterations_per_second(value)
getter get_iterations_per_second
  • float physics_jitter_fix
Default 0.5
setter set_physics_jitter_fix(value)
getter get_physics_jitter_fix
  • int target_fps
Default 0
setter set_target_fps(value)
getter get_target_fps
  • float time_scale
Default 1.0
setter set_time_scale(value)
getter get_time_scale

方法说明

  • get_author_info get_author_info() const

返回字典中的引擎作者信息。

lead_developers -字符串数组,主要开发人员姓名

founders -字符串数组,创建者名称

project_managers -字符串数组,项目经理名称

developers -字符串数组,开发人员名称


  • get_copyright_info get_copyright_info() const

返回版权信息字典数组。

name-字符串,组件名称

parts-字典数组{filescopyrightlicense},描述了组件的各个子节


  • get_donor_info get_donor_info() const

返回捐助者名称数组的字典。

{platinum_sponsorsgold_sponsorsmini_sponsorsgold_donorssilver_donors,`bronze_donors}


  • get_frames_drawn get_frames_drawn()

返回绘制的帧总数。如果--disable-render-loop通过命令行禁用了渲染循环,则返回0。见get_idle_frames


  • get_frames_per_second get_frames_per_second() const

返回正在运行的游戏的每秒帧数。


  • get_idle_frames get_idle_frames() const

返回自引擎初始化以来传递的帧总数,无论是否启用了渲染循环,该帧都会在每个**空闲帧**上超前。见get_frames_drawn


  • get_license_info get_license_info() const

返回IdeaVR使用的许可字典,包括第三方组件。


  • get_license_text get_license_text() const

返回IdeaVR许可证文本。


  • get_main_loop get_main_loop() const

返回主循环对象(见MainLoopSceneTree)。


  • get_physics_frames get_physics_frames() const

返回自引擎初始化以来传递的帧总数,该总数在每个**物理帧**上超前。


  • get_physics_interpolation_fraction get_physics_interpolation_fraction() const

返回渲染框架时当前物理滴答度中的分数。这可用于实现固定的时间步插值。


  • get_singleton get_singleton(name: String) const

返回具有给定name的全局单例。通常用于插件,例如GodotPayment在Android上。


  • get_version_info get_version_info() const

返回字典中的当前引擎版本信息。

major - 将主要版本号保存为int

minor - 将次要版本号保存为int

patch - 将补丁版本号保存为int

hex - 保留编码为十六进制int的完整版本号,每个编号一个字节(2个地方)(请参见下面的示例)

status - 以字符串形式保存状态(例如“ beta”,“ rc1”,“ rc2”,...“stable”)

build - 将构建名称(例如“ custom_build”)保存为字符串

hash - 将完整的Git提交哈希保存为字符串

year - 保留该版本作为int发行的年份

string - 包含major + minor + patch + status + build的单个字符串

hex从左到右编码如下:主字节为1个字节,次字节为1个字节,修补程序版本为1个字节。例如,“3.1.12”应为0x03010C。注意:它在内部仍然是int,打印出来会得到十进制表示,这并不是特别有意义。使用十六进制文字从代码中轻松进行版本比较:

if Engine.get_version_info().hex >= 0x030200:
    # 针对3.2及后续版本执行该逻辑
else:
    # 针对版本3.2以前版本执行该逻辑

  • has_singleton has_singleton(name: String) const

如果全局范围内存在具有给定name的单例,则返回true


  • is_in_physics_frame is_in_physics_frame() const

如果游戏在游戏循环的固定过程和物理阶段内,则返回true