+1 vote

Can I draw some debug 2d lines on top of viewport in editor, using tool mode?
How can I do that?

I have button turning editing mode for some change in my scene, I would like to draw red border in viewport (3d mode in editor) for indicating this process and remove it when "edit mode" is turned off.


asked Jun 27, 2018 in Engine by websterek (229 points)

1 Answer

0 votes

I usually achieve this in my main 'CanvasItem' using a 'drawline()' function. I have a bool 'isdebug_on' which toggles with button presses, and if it's true I jus call some draw code in the 'draw()' method of the canvas item.

answered Jun 27, 2018 by Diet Estus (1,504 points)

Ohhh it's sound very legit, I will check that, thanks!

But this method is working when game is played? I'm looking for something working inside editor or maybe I don't know how to set-up that? :P

Yes, it only works in the game, not the editor.

You can use tool mode to draw things in editor.

How can I do that? For 2D it's not a problem, but how draw somthing 2d on 3d editor viewport?

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.