Construction Script Draw Debug Line

I need to be able to draw a debug line between 2 points indefinitely within the construction script so that i can see it within the editor when I’m not in Play Mode.

Does anyone have any idea how to do this besides setting the duration to a high number?

Setting duration to -1 or 0 doesn’t work either.

If there is a better way to visualize a connection between 2 points indefinitely within the editor then im all ears.

1 Like

you might have better luck using an arrow component extending between the two points in space.

1 Like

Just put the duration to a very high number like 9999. I do this with many of my blueprints and it hasn’t caused any issues.

Just make sure you put a Flush Persistent Debug Lines node at the beginning of your construction script so it removes the old debug lines every time it runs instead of stacking them.

2 Likes

This might be a nice option.

Increasing the duration works.

The problem with using a high duration and Flush Persistent Debug Lines is that it limits you to seeing exactly one instance of your blueprint as construction will make all other instances invisible, as well as any other blueprints that use the same method.

I recently ran into this same issue and ended up building a C++ side component with a matching FComponentVisualizer. I later found out that I could have also built a C++ component and matching FPrimitiveSceneProxy. The distinction is important as FComponentVisualizers only draw when the object is selected while FPrimitiveSceneProxys can be set to at all times or just when the object is selected.

Thanks it’s that ! “Flush Persistant Debug Lines” ! So happy thanks ! Works for my “Draw Debug Box”.

Have fun !

As noted by +nonrandom’s answer, this technique only works for one active instance of the blueprint. As soon as you have two of them, adjusting one will erase all lines for all others.