• 2D
  • How do I override debug drawing?

How do I override the way my collision shapes are drawn in debug? For instance, I'd love to change the color certain shapes are drawn, but in general I'd love to overload the _draw() function for debug specific behavior in a few scenes..

Not sure if this is possible but that would be pretty useful.

Unfortunately I do not think it’s possible, as much of Godot’s editor gizmos and drawing code is completely separate from the node itself. You can kinda work around this by disabling the gizmo and then drawing your own.

I do not remember 100% right off, but I think there is a drop down in the editor view, I think it’s called view, gizmos or `visibility, and then it will present a drop down with checkboxes for each node gizmo type. Then you can click the collision shape gizmo, which should make it no longer drawn. Not really a solution, but it may help as a workaround.

Is there a piece of code I can run to test whether I'm running a debug build or not?

And since it is a boolean you can also use !Engine.editor_hint (test in a if statement for an example) for cases where you want a code block or line to be game/runtime specific only.