+4 votes

Is there a way to check if the game is running by the editor or it self?

in Engine by (195 points)

2 Answers

+11 votes
Best answer

You can check for the presence of the standalone feature tag:

if OS.has_feature("standalone"):
    print("Running an exported build.")
else:
    print("Running from the editor.")

Unlike OS.is_debug_build(), it'll evaluate to true even in debug export templates.

by (12,355 points)
selected by
+4 votes

I use this to skip the intro scene in editor (not to waste time).

func _ready():
   if OS.has_feature("editor"):
      get_tree().change_scene_to(nextScene)

You can check more options. Awesome stuff:
https://docs.godotengine.org/en/stable/getting_started/workflow/export/feature_tags.html

by (312 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.