summaryrefslogtreecommitdiff
path: root/doc/classes/Engine.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/Engine.xml')
-rw-r--r--doc/classes/Engine.xml40
1 files changed, 35 insertions, 5 deletions
diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml
index 886a18900e..36590093bd 100644
--- a/doc/classes/Engine.xml
+++ b/doc/classes/Engine.xml
@@ -37,7 +37,7 @@
<method name="get_frames_drawn">
<return type="int" />
<description>
- Returns the total number of frames drawn. If the render loop is disabled with [code]--disable-render-loop[/code] via command line, this returns [code]0[/code]. See also [method get_process_frames].
+ Returns the total number of frames drawn. On headless platforms, or if the render loop is disabled with [code]--disable-render-loop[/code] via command line, [method get_frames_drawn] always returns [code]0[/code]. See [method get_process_frames].
</description>
</method>
<method name="get_frames_per_second" qualifiers="const">
@@ -67,7 +67,13 @@
<method name="get_physics_frames" qualifiers="const">
<return type="int" />
<description>
- Returns the total number of frames passed since engine initialization which is advanced on each [b]physics frame[/b].
+ Returns the total number of frames passed since engine initialization which is advanced on each [b]physics frame[/b]. See also [method get_process_frames].
+ [method get_physics_frames] can be used to run expensive logic less often without relying on a [Timer]:
+ [codeblock]
+ func _physics_process(_delta):
+ if Engine.get_physics_frames() % 2 == 0:
+ pass # Run expensive logic only once every 2 physics frames here.
+ [/codeblock]
</description>
</method>
<method name="get_physics_interpolation_fraction" qualifiers="const">
@@ -79,16 +85,27 @@
<method name="get_process_frames" qualifiers="const">
<return type="int" />
<description>
- Returns the total number of frames passed since engine initialization which is advanced on each [b]process frame[/b], regardless of whether the render loop is enabled. See also [method get_frames_drawn].
+ Returns the total number of frames passed since engine initialization which is advanced on each [b]process frame[/b], regardless of whether the render loop is enabled. See also [method get_frames_drawn] and [method get_physics_frames].
+ [method get_process_frames] can be used to run expensive logic less often without relying on a [Timer]:
+ [codeblock]
+ func _process(_delta):
+ if Engine.get_process_frames() % 2 == 0:
+ pass # Run expensive logic only once every 2 process (render) frames here.
+ [/codeblock]
</description>
</method>
<method name="get_singleton" qualifiers="const">
<return type="Object" />
- <argument index="0" name="name" type="String" />
+ <argument index="0" name="name" type="StringName" />
<description>
Returns a global singleton with given [code]name[/code]. Often used for plugins, e.g. GodotPayments.
</description>
</method>
+ <method name="get_singleton_list" qualifiers="const">
+ <return type="PackedStringArray" />
+ <description>
+ </description>
+ </method>
<method name="get_version_info" qualifiers="const">
<return type="Dictionary" />
<description>
@@ -125,7 +142,7 @@
</method>
<method name="has_singleton" qualifiers="const">
<return type="bool" />
- <argument index="0" name="name" type="String" />
+ <argument index="0" name="name" type="StringName" />
<description>
Returns [code]true[/code] if a singleton with given [code]name[/code] exists in global scope.
</description>
@@ -136,6 +153,19 @@
Returns [code]true[/code] if the game is inside the fixed process and physics phase of the game loop.
</description>
</method>
+ <method name="register_singleton">
+ <return type="void" />
+ <argument index="0" name="name" type="StringName" />
+ <argument index="1" name="instance" type="Object" />
+ <description>
+ </description>
+ </method>
+ <method name="unregister_singleton">
+ <return type="void" />
+ <argument index="0" name="name" type="StringName" />
+ <description>
+ </description>
+ </method>
</methods>
<members>
<member name="editor_hint" type="bool" setter="set_editor_hint" getter="is_editor_hint" default="true">