diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/Engine.xml | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml index 6e22c58024..f05a216301 100644 --- a/doc/classes/Engine.xml +++ b/doc/classes/Engine.xml @@ -147,6 +147,20 @@ Returns [code]true[/code] if a singleton with given [code]name[/code] exists in global scope. </description> </method> + <method name="is_editor_hint" qualifiers="const"> + <return type="bool" /> + <description> + Returns [code]true[/code] if the script is currently running inside the editor, [code]false[/code] otherwise. This is useful for [code]@tool[/code] scripts to conditionally draw editor helpers, or prevent accidentally running "game" code that would affect the scene state while in the editor: + [codeblock] + if Engine.is_editor_hint(): + draw_gizmos() + else: + simulate_physics() + [/codeblock] + See [url=https://docs.godotengine.org/en/latest/tutorials/plugins/running_code_in_the_editor.html]Running code in the editor[/url] in the documentation for more information. + [b]Note:[/b] To detect whether the script is run from an editor [i]build[/i] (e.g. when pressing [kbd]F5[/kbd]), use [method OS.has_feature] with the [code]"editor"[/code] argument instead. [code]OS.has_feature("editor")[/code] will evaluate to [code]true[/code] both when the code is running in the editor and when running the project from the editor, but it will evaluate to [code]false[/code] when the code is run from an exported project. + </description> + </method> <method name="is_in_physics_frame" qualifiers="const"> <return type="bool" /> <description> @@ -168,17 +182,6 @@ </method> </methods> <members> - <member name="editor_hint" type="bool" setter="set_editor_hint" getter="is_editor_hint" default="true"> - If [code]true[/code], the script is currently running inside the editor. This is useful for [code]@tool[/code] scripts to conditionally draw editor helpers, or prevent accidentally running "game" code that would affect the scene state while in the editor: - [codeblock] - if Engine.editor_hint: - draw_gizmos() - else: - simulate_physics() - [/codeblock] - See [url=https://docs.godotengine.org/en/latest/tutorials/plugins/running_code_in_the_editor.html]Running code in the editor[/url] in the documentation for more information. - [b]Note:[/b] To detect whether the script is run from an editor [i]build[/i] (e.g. when pressing [kbd]F5[/kbd]), use [method OS.has_feature] with the [code]"editor"[/code] argument instead. [code]OS.has_feature("editor")[/code] will evaluate to [code]true[/code] both when the code is running in the editor and when running the project from the editor, but it will evaluate to [code]false[/code] when the code is run from an exported project. - </member> <member name="physics_jitter_fix" type="float" setter="set_physics_jitter_fix" getter="get_physics_jitter_fix" default="0.5"> Controls how much physics ticks are synchronized with real time. For 0 or less, the ticks are synchronized. Such values are recommended for network games, where clock synchronization matters. Higher values cause higher deviation of the in-game clock and real clock but smooth out framerate jitters. The default value of 0.5 should be fine for most; values above 2 could cause the game to react to dropped frames with a noticeable delay and are not recommended. [b]Note:[/b] For best results, when using a custom physics interpolation solution, the physics jitter fix should be disabled by setting [member physics_jitter_fix] to [code]0[/code]. |