I would like to draw some vectors using DrawDebugArrow in Blueprints. The problem is I can’t always see them, when the vectors are inside of an object. Is there any solution to draw them on top of everything on screen?
As you can see in the picture, red arrow is almost inside and hard to see
You can use Custom Depth with a Post Process Material: Post Process Materials | Unreal Engine Documentation
I have already added comment to your answer, but it seems like it is deleted. lol. Anyway I don’t know how I can apply a Post Process Material to debug arrow. Documentation says it works with meshes and arrow is not a mesh I think.
I haven’t found any solution, so I decided to see the implementation of debug arrow, and it turned out the functionality I need is already there.
All I had to do was to change one argument in function. By default the value was SDPG_World and changing it to SDPG_Foreground make the arrow render always on top exactly like I wanted.
I don’t understand why this argument is not exposed for blueprints by default.
Here is the result
Sorry, I might have missed that only DrawDebugArrow works for you. I don’t think it’s possible to do what you want with DrawDebug commands, as you can’t control the mesh nor the material that is drawn, and you need to have a separate depth pass for meshes that you’d like to draw on top.
I found a solution, but I had to make changes to the function in C++. I added the solution in an answer.
Yes, it took me a lot of time with my third world computer to compile it and almost 80GB of space (source, project files for visual studio, binaries, etc) but it worked XD
Nice find, although I guess then you have a source build of the engine, right?
You could have just made a blueprint function library in c++ and made your own function.
Kinda like this:
void MyBPLibrary::DrawDebugArrowForeground(const UObject* WorldContextObject, FVector const LineStart, FVector const LineEnd, float ArrowSize, FLinearColor Color, float LifeTime, float Thickness)
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (World != nullptr)
DrawDebugDirectionalArrow(World, LineStart, LineEnd, ArrowSize, Color.ToFColor(true), false, LifeTime, SDPG_Foreground, Thickness);
No engine build required