tool mode drawing lines on viewport

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

Hello!
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.

Best!

:bust_in_silhouette: Reply From: Diet Estus

I usually achieve this in my main ‘CanvasItem’ using a ‘draw_line()’ function. I have a bool ‘is_debug_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.

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

websterek | 2018-06-27 14:25

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? :stuck_out_tongue:

websterek | 2018-06-27 14:33

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

Diet Estus | 2018-06-27 23:42

You can use tool mode to draw things in editor.

eons | 2018-06-28 01:23

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

websterek | 2018-06-28 07:53