+5 votes

Hi guys! I have this situation- I'd like to be able to draw one thing when editing my own custom node(made as an editor plugin) and other thing when the game is being run.

Similar thing you can see when editing Path2D- when editing you can see the path and control points, but when you run the game, it's not visible.

Maybe there's some good workaround if the feature isn't implemented yet?

in Engine by (52 points)

2 Answers

+3 votes
Best answer

You can use get_tree().is_editor_hint() to find out whether you are running in the editor or in the game.

by (370 points)
selected by
Awesome! Thank you very much!
0 votes

For people using Godot 3, you have to replace get_tree().is_editor_hint() by Engine.editor_hint.

by (1,044 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 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.