Nope, still won’t show up even with scene view hidden. I’ll try to test it out tomorrow with a fresh project to see if it’s some setting I’ve changed somewhere
EDIT: It does work in a new project. It seems like some setting or conflicting package is causing this, I’m in the process of narrowing it down.
Ok I think I figured it out. It seems like if I have any UI elements, it breaks the in-game rendering (so not directly related to any packages). Using OnGUI seems to break it completely, while using a UI element on a canvas seems to make all the debug shapes render super far away.
I have a pretty fragile workaround though:
Don’t use SMAA on my camera
Have some post-processing effect, such as bloom, enabled
I add this to UnityGLDebug.cs: void OnRenderObject() => RenderLines(); (this seems to be needed even though I’m using URP with compatibility mode disabled)
Doing all of that still lets me render my UI and have the debug lines show up. It also seems that when using OnRenderObject, the lines are affected by post-processing effects (such as bloom or DOF) but without that (and with no UI elements rendering), the lines are not affected by post-processing.
Here is a minimal example project demonstrating all of this: My project.zip (317.3 KB)
That’s an interesting bug that you found, I wonder what exactly might be happening with the combination of systems together. I will investigate this one before adding the patch. Would love to prevent having to call the draw lines that many times
I can confirm the replacement GLDebug script I provided is working in URP (Forward Renderer) Unity 6 without requiring PlayMode Gizmos enabled, post processing, or calling OnRenderObject.
I am using PreviewCondition.Both, 1f DrawDuration. (Lower draw durations work)
@amrahm If you are using the new GLDebug script, deleted the old dll + (restarted Unity), ensured the script is on your main camera, and still aren’t seeing the drawing, you can try replacing the shaders with these ones that are URP specific (although the originals work for me). Bear in mind if you use a the default draw duration it will only draw roughly every frame that it’s called.
@Rotary-Heart I like to make RotaryHeart.Lib.PhysicsExtension.DebugExtensions and it’s methods public so we can draw for debugging outside of Physics casts. This expands it’s uses massively.
I have not published an update with this fix since it seems there is still some issues to be fixed with this implementation. I can live with the issue of only having game view open to be able to see it, but there seems to be an issue with zdepth on URP that I have not yet been able to solve.
I have game and scene view side by side and it works. I may have noticed the zdepth thing when trying to correct the z-on shader, I can get it to work in the scene view but it’s affected by the camera angle/z-fighting in the game view. I can live without the depth but will investigate this.
@amrahm 's solution works for fixing Z by replacing OnCameraRender with void OnRenderObject() => RenderLines(); . My ZOn shader has ZWrite Off ZTest LEqual
Are you sure it was limited to URP? I have unified the DrawLine and DrawRay methods to trim the fat in the DebugExtensions and noticed there were a few missing drawDepth flags on some of the Draw calls, and some accidental “Debug.” where “GLDebug.” were supposed to be.
I’ve also added DrawBounds, DrawArrow, and DrawCone
@haywirephoenix I have made the debug class public and all it’s members so you can implement your own partial class for it and extend it with your own cone and any other debug methods you had.
In 2.0 I couldn’t get the lines to display in the Game view and found that the shaders weren’t being assigned. I modified the MaterialSetup method to grab the shaders before creating the materials and it’s all working great now in URP.