Hi,

I would like to know if it's possible to debug 3D gizmos (Wire spheres, cubes or even lines) in godot (like in Unity using the OnDrawGizmos or the Debug.DrawRay methods) ? I'm currently working on procedural mesh generation and it is a very usefull debugging tool.

Thank you in advance !

I do not think there is any debug drawing capabilities in Godot that are similar to Unity’s debug draw functions, unfortunately.

You can use create those shapes using one of Godot’s procedural generation methods (documentation). You can add tool keyword to the script if you want it to execute in the editor.

Also, welcome to the forums!

Thank you for welcoming me :)

In the end I will probably make my own utils methods with the draw node and the Tool attribute, thanks.

I've create a simple C# script capable of drawing lines, I will expand it with other usefull functions.

However I've two issues, the SetColor isn't coloring the geometry and nothing is showing in the editor's viewport while I can see it working in the game.

Any thought about this ?

using Godot; using System; using System.Collections.Generic; [Tool] // Not working in editor public class DebugUtils : ImmediateGeometry { public static DebugUtils instance; List<Vector3> points = new List<Vector3>(); public override void _Ready() { if(instance == null) { instance = this; } else { GD.PrintErr("Duplication of singleton !"); } } private void AddLine(Vector3 a, Vector3 b) { points.Add(a); points.Add(b); } public static void Line(Vector3 a, Vector3 b) { instance.AddLine(a, b); } public override void _Process(float delta) { Clear(); Begin(Mesh.PrimitiveType.Lines); SetColor(new Color(1, 0, 0, 1)); //Not working... if (points.Count >= 2) { for (int i = 0; i < points.Count - 1; i+=2) { AddVertex(points[i]); AddVertex(points[i + 1]); } } End(); points.Clear(); } }

3 years later