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


in Engine by (227 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.

by (1,586 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 Frequently asked questions and 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 [email protected] with your username.