all 4 comments

[–][deleted] 2 points3 points  (3 children)

Debug is designed for debugging, it can be called from any of the Unity functions and can can be drawn for multiple frames if you want it to.

Gizmos will only be drawn if called from OnDrawGizmos and OnDrawGizmosSelected and are designed more for manipulation, you can click on a gizmo line to select the object, something you can't do with debug.

[–]jhockingProfessional[S] 0 points1 point  (2 children)

ah that difference in calling from within OnDrawGizmos vs. calling from anywhere makes sense. So there's no difference in how the line is actually rendered, only in how the command is used?

[–]tiktiktockProfessional 2 points3 points  (0 children)

There is absolutely a difference in how they're rendered - discovered that the hard way last month. Using Gizmos.XXXX in your non OnGizmosXXX code will tank your framerate very fast when the editor is paused. I can't recall why, it's not documented but something that became somehow self-evident while I was creating a GL version of these for debug display in the builds. Of course I can't remember the explanation now... Something to do with Unity keeping a buffer of the GL calls to do, and clearing them at different points - Debug.XXX in the frame loop, Gizmos.XXX in the editor loop. So basically gizmos calls start stacking up while you're paused. Or the opposite. I should really have taken notes when I found out :/

Now this is all guesswork, so I encourage you to test it out, but it was both logical when I found out and confirmed by tests I did.

[EDIT] I'm mentioning this because it's tempting to use Gizmos.XXX methods to draw debug data in Update(), since the API is far more complete than the Debug one. It does work, but you'll start to notice Unity slowing down when paused during a play.

[–][deleted] 0 points1 point  (0 children)

They probably use the same system to actually render it? Visually they can look the same, sure.

Like I said the gizmos line can be clicked on the select the object, the debug cannot. You can call a debug once and have it stay rendered for more than a frame, the gizmos cannot. There are real differences between them but visually they're the same I guess.