Is it possible to detect if we're running in the Editor GUI versus an editor exe invoke?

Godot Version

4.3

Context

  • I’m developing on Windows using C# and VSCode
  • I’ll define the Editor GUI for this question as the Godot Editor with the scene tree, inspector, etc
  • I’ll define the Godot.exe for this question as Godot_v4.3-stable_mono_win64.exe

My workflow is to develop in VSCode 99% of the time and only use the Editor GUI when creating new scenes. This means I run/debug my game via a vscode launch command, which under the hood invokes the Godot.exe; the Editor GUI is not opened.

I’m aware of OS.HasFeature( "editor" ), however, this returns true even when starting the game via the Godot.exe. This makes sense since it’s the same executable for opening the Editor GUI.

Question

Is there a way to detect if I’m running in the Editor GUI via the Play button (F5) versus a command line invocation of the Godot.exe?

I’m assuming I could use OS.GetCmdlineArgs() and pass custom arguments, however, I’d like to know if there’s a built-in way of checking such a state.

Engine.IsEditorHint()

Engine.IsEditorHint() is for tools. I’m not asking about tools.

1 Like

if OS.is_debug_build():

I’ll blur my incorrect answer, misunderstood the question.

Ryn.

OS.IsDebugBuild() is not the answer either; this returns true when invoking godot.exe from the command line and when running via the Editor GUI with the play button.

After researching and tinkering, I’ve concluded Godot does not currently support detection and custom command line parameters must be used.