# How to draw debug arrow on top?

**URL:** <https://forums.unrealengine.com/t/how-to-draw-debug-arrow-on-top/449063>\
**Category:** Debugging, Optimization, & Profiling\
**Tags:** debug, draw, unreal-engine, vector, question\
**Created:** [May 16, 2019, 8:25am UTC](https://forums.unrealengine.com/t/how-to-draw-debug-arrow-on-top/449063 "2019-05-16T08:25:48Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_9ecf23871](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9ecf23871](https://forums.unrealengine.com/u/anonymous_user_9ecf23871)\
**Post date:** [May 16, 2019, 8:25am UTC](https://forums.unrealengine.com/t/how-to-draw-debug-arrow-on-top/449063/1 "2019-05-16T08:25:48Z")

</div>

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?

 ![276967-ue4.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/4/284a089535bfff216a63ee7f0a853496059f6052.png)

As you can see in the picture, red arrow is almost inside and hard to see

---

<div class="post-metadata">

**Author:** ![KristofMorva](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kristofmorva/32/1194508_2.png) [@KristofMorva](https://forums.unrealengine.com/u/KristofMorva)\
**Post date:** [May 16, 2019, 9:31am UTC](https://forums.unrealengine.com/t/how-to-draw-debug-arrow-on-top/449063/2 "2019-05-16T09:31:06Z")

</div>

You can use Custom Depth with a Post Process Material: [Post Process Materials | Unreal Engine Documentation](https://docs.unrealengine.com/en-US/Engine/Rendering/PostProcessEffects/PostProcessMaterials)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_9ecf23871](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9ecf23871](https://forums.unrealengine.com/u/anonymous_user_9ecf23871)\
**Post date:** [May 20, 2019, 6:39pm UTC](https://forums.unrealengine.com/t/how-to-draw-debug-arrow-on-top/449063/3 "2019-05-20T18:39:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_9ecf23871](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9ecf23871](https://forums.unrealengine.com/u/anonymous_user_9ecf23871)\
**Post date:** [May 20, 2019, 6:49pm UTC](https://forums.unrealengine.com/t/how-to-draw-debug-arrow-on-top/449063/4 "2019-05-20T18:49:45Z")

</div>

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.

 ![277454-beztytułu.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/1/b/21b98c61363e3609aec262cbbf042de30f30eabc.png)

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

 ![277455-beztytułu.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/6/b/76b33af4d876379bdb028e3b9374a31eb3802bbf.png)

---

<div class="post-metadata">

**Author:** ![KristofMorva](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kristofmorva/32/1194508_2.png) [@KristofMorva](https://forums.unrealengine.com/u/KristofMorva)\
**Post date:** [May 20, 2019, 6:49pm UTC](https://forums.unrealengine.com/t/how-to-draw-debug-arrow-on-top/449063/5 "2019-05-20T18:49:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_9ecf23871](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9ecf23871](https://forums.unrealengine.com/u/anonymous_user_9ecf23871)\
**Post date:** [May 20, 2019, 6:58pm UTC](https://forums.unrealengine.com/t/how-to-draw-debug-arrow-on-top/449063/6 "2019-05-20T18:58:50Z")

</div>

I found a solution, but I had to make changes to the function in C++. I added the solution in an answer.

---

<div class="post-metadata">

**Author:** ![KristofMorva](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kristofmorva/32/1194508_2.png) [@KristofMorva](https://forums.unrealengine.com/u/KristofMorva)\
**Post date:** [May 20, 2019, 7:11pm UTC](https://forums.unrealengine.com/t/how-to-draw-debug-arrow-on-top/449063/7 "2019-05-20T19:11:00Z")

</div>

Nice find, although I guess then you have a source build of the engine, right?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_9ecf23871](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9ecf23871](https://forums.unrealengine.com/u/anonymous_user_9ecf23871)\
**Post date:** [May 20, 2019, 7:44pm UTC](https://forums.unrealengine.com/t/how-to-draw-debug-arrow-on-top/449063/8 "2019-05-20T19:44:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Niklas\_Sommer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Niklas\_Sommer](https://forums.unrealengine.com/u/Niklas_Sommer)\
**Post date:** [October 22, 2022, 7:55pm UTC](https://forums.unrealengine.com/t/how-to-draw-debug-arrow-on-top/449063/9 "2022-10-22T19:55:00Z")

</div>

You could have just made a blueprint function library in c++ and made your own function.  
Kinda like this:

```auto
#include "DrawDebugHelpers.h"

void MyBPLibrary::DrawDebugArrowForeground(const UObject* WorldContextObject, FVector const LineStart, FVector const LineEnd, float ArrowSize, FLinearColor Color, float LifeTime, float Thickness)
{
#if ENABLE_DRAW_DEBUG
	UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
	if (World != nullptr)
	{
		DrawDebugDirectionalArrow(World, LineStart, LineEnd, ArrowSize, Color.ToFColor(true), false, LifeTime, SDPG_Foreground, Thickness);
	}
#endif
}

```

No engine build required
