EngineEditorHint Property |
If true, the script is currently running inside the editor. This is useful for tool scripts to conditionally draw editor helpers, or prevent accidentally running "game" code that would affect the scene state while in the editor:
if Engine.editor_hint: draw_gizmos() else: simulate_physics()
See Running code in the editor in the documentation for more information.
Note: To detect whether the script is run from an editor build (e.g. when pressing F5), use HasFeature(String) with the "editor" argument instead. OS.has_feature("editor") will evaluate to true both when the code is running in the editor and when running the project from the editor, but it will evaluate to false when the code is run from an exported project.
Namespace: Godot