+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?

asked Feb 29, 2016 in Engine by Ugis Brekis (51 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.

answered Feb 29, 2016 by umfk (366 points)
selected Feb 29, 2016 by Ugis Brekis
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.

answered Mar 15, 2018 by BraindeadBZH (1,020 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.