Know whether the node is running in the editor or in game

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By sygi

I have a tool node. It has an overridden _draw, where I’m putting some debug-like info on top of the node. I would like this info to only show when in editor, but not in game, is there something like:

func _draw():
  if IN_EDITOR:
    draw_line(...)

There’s Engine.editor_hint. Should have looked deeper before posting

sygi | 2021-03-07 18:40

:bust_in_silhouette: Reply From: exuin

Try using OS.has_feature(“editor”).