# How to use depth priority when debug drawing in c++?

**URL:** <https://forums.unrealengine.com/t/how-to-use-depth-priority-when-debug-drawing-in-c/331014>\
**Category:** Debugging, Optimization, & Profiling\
**Tags:** debug, depth, unreal-engine, UE4, CPP, question\
**Created:** [September 4, 2015, 10:01am UTC](https://forums.unrealengine.com/t/how-to-use-depth-priority-when-debug-drawing-in-c/331014 "2015-09-04T10:01:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_08c2fdfc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_08c2fdfc](https://forums.unrealengine.com/u/anonymous_user_08c2fdfc)\
**Post date:** [September 4, 2015, 10:01am UTC](https://forums.unrealengine.com/t/how-to-use-depth-priority-when-debug-drawing-in-c/331014/1 "2015-09-04T10:01:23Z")

</div>

For example `DrawDebugDirectionalArrow()` takes a DepthPriority as a parameter, but I don’t know how to use it. When I give `1` or `(uint8)('\001')` it does not appear on the screen ; and when I give `(uint8)('\002')` or greater I can see it but not in front of other objects (same as with the default value `(uint8)('\000')`).

How can I have my debug drawings in front of anything else?

---

<div class="post-metadata">

**Author:** ![darkZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@darkZ](https://forums.unrealengine.com/u/darkZ)\
**Post date:** [March 5, 2016, 9:10pm UTC](https://forums.unrealengine.com/t/how-to-use-depth-priority-when-debug-drawing-in-c/331014/2 "2016-03-05T21:10:25Z")

</div>

Have you managed to figure this out yet ?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_08c2fdfc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_08c2fdfc](https://forums.unrealengine.com/u/anonymous_user_08c2fdfc)\
**Post date:** [March 6, 2016, 8:51pm UTC](https://forums.unrealengine.com/t/how-to-use-depth-priority-when-debug-drawing-in-c/331014/3 "2016-03-06T20:51:58Z")

</div>

nope :-/ …

---

<div class="post-metadata">

**Author:** ![huulong](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@huulong](https://forums.unrealengine.com/u/huulong)\
**Post date:** [August 22, 2017, 1:57pm UTC](https://forums.unrealengine.com/t/how-to-use-depth-priority-when-debug-drawing-in-c/331014/4 "2017-08-22T13:57:50Z")

</div>

Have you tried SDPG\_Foreground and SDPG\_MAX from ESceneDepthPriorityGroup? ([API](https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/Engine/ESceneDepthPriorityGroup/index.html)) Inspecting DrawDebugHelpers.cpp makes me think they are the original enum values. That said, SDPG\_Foreground should be equal to 1 and SDPG\_MAX to 2, so it may give the same results…

---

<div class="post-metadata">

**Author:** ![Divistri](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Divistri](https://forums.unrealengine.com/u/Divistri)\
**Post date:** [July 19, 2018, 9:10pm UTC](https://forums.unrealengine.com/t/how-to-use-depth-priority-when-debug-drawing-in-c/331014/5 "2018-07-19T21:10:50Z")

</div>

This gives the same results for me in 4.19.

Has depth priority for debug drawing been nonfunctional for almost 3 years?

---

<div class="post-metadata">

**Author:** ![Termitosss](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/termitosss/32/88716_2.png) [@Termitosss](https://forums.unrealengine.com/u/Termitosss)\
**Post date:** [May 4, 2022, 12:52pm UTC](https://forums.unrealengine.com/t/how-to-use-depth-priority-when-debug-drawing-in-c/331014/6 "2022-05-04T12:52:51Z")

</div>

> [@huulong](#):
>
> Have you tried SDPG\_Foreground and SDPG\_MAX from ESceneDepthPriorityGroup? ([API](https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/Engine/ESceneDepthPriorityGroup/index.html)) Inspecting DrawDebugHelpers.cpp makes me think they are the original enum values. That said, SDPG\_Foreground should be equal to 1 and SDPG\_MAX to 2, so it may give the same results…

Thanks! This works for me in UE 4.27, I am using SDPG\_Foreground 🙂

---

<div class="post-metadata">

**Author:** ![RobossRex](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RobossRex](https://forums.unrealengine.com/u/RobossRex)\
**Post date:** [July 16, 2022, 1:16am UTC](https://forums.unrealengine.com/t/how-to-use-depth-priority-when-debug-drawing-in-c/331014/7 "2022-07-16T01:16:29Z")

</div>

Use ECC\_WorldStatic  
This has worked for everything I’ve needed but there must be others should you need them.  
IntelliSense gave me this as recommended so I guess they must have made it easier since you guys had this problem - it was still confusing as the parameter had a terrible prompt.  
Just for anyone else who comes across this thread.
