# How to use FDebugRenderSceneProxy

**URL:** <https://forums.unrealengine.com/t/how-to-use-fdebugrendersceneproxy/413562>\
**Category:** Rendering\
**Tags:** Render, debug-draw, unreal-engine, proxy, Rendering, question\
**Created:** [January 2, 2018, 8:40am UTC](https://forums.unrealengine.com/t/how-to-use-fdebugrendersceneproxy/413562 "2018-01-02T08:40:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Takatu](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/takatu/32/976600_2.png) [@Takatu](https://forums.unrealengine.com/u/Takatu)\
**Post date:** [January 2, 2018, 8:40am UTC](https://forums.unrealengine.com/t/how-to-use-fdebugrendersceneproxy/413562/1 "2018-01-02T08:40:16Z")

</div>

Hi,

I have a component UMyComponent (derived from UPrimitiveComponent) and want to draw some debug info. For that I have overwritten the CreateSceneProxy function and create a FDebugRenderSceneProxy. See code below. But its not rendering anything.

```
FPrimitiveSceneProxy* UMyComponent::CreateSceneProxy()
{
	auto proxy = new FDebugRenderSceneProxy(this);
	proxy->DrawType = FDebugRenderSceneProxy::SolidAndWireMeshes;
	proxy->ViewFlagName = TEXT("OnScreenDebug");
	proxy->ViewFlagIndex = uint32(FEngineShowFlags::FindIndexByName(*proxy->ViewFlagName));

	FDebugRenderSceneProxy::FDebugLine dbgLine(FVector(0.f, 0.f, 0.f), FVector(0.0f, 0.0f, 10000.f), FColor::Orange, 160.f);
	proxy->Lines.Add(dbgLine);
	proxy->Boxes.Add(FDebugRenderSceneProxy::FDebugBox(FBox(FVector(-1000.f, -1000.f, -1000.f), FVector(1000.f, 1000.f, 1000.f)), FColor::Green, FTransform::Identity));

	return proxy;
}

```

“OnScreenDebug” show flag is enabled in the editor.

What do I do wrong or what do I missed?

Thanks,  
Takatu

---

<div class="post-metadata">

**Author:** ![Takatu](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/takatu/32/976600_2.png) [@Takatu](https://forums.unrealengine.com/u/Takatu)\
**Post date:** [January 30, 2018, 7:30am UTC](https://forums.unrealengine.com/t/how-to-use-fdebugrendersceneproxy/413562/2 "2018-01-30T07:30:30Z")

</div>

Its now a while and I still need it and I still don’t know how.

---

<div class="post-metadata">

**Author:** ![SteamPunkProgrammer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SteamPunkProgrammer](https://forums.unrealengine.com/u/SteamPunkProgrammer)\
**Post date:** [October 16, 2023, 2:34pm UTC](https://forums.unrealengine.com/t/how-to-use-fdebugrendersceneproxy/413562/3 "2023-10-16T14:34:04Z")

</div>

for anyone else who arrives here looking for the solution, I figured it out.

a couple more things need to be setup.

override ShouldRecreateProxyOnUpdateTransform to return true.  
override CalcBounds to return whatever bounds makes sense for your component.

and finally, you need to extend FDebugRenderSceneProxy to override the GetViewRelevance method like so.

```auto
class FCustomDebugRenderSceneProxy : public FDebugRenderSceneProxy
{
	
public:
	
	FCustomDebugRenderSceneProxy(const UPrimitiveComponent* InComponent)
		: FDebugRenderSceneProxy(InComponent)
	{
	}
	
	virtual FPrimitiveViewRelevance GetViewRelevance(const FSceneView* View) const override
	{
		FPrimitiveViewRelevance Result;
		Result.bDrawRelevance = IsShown(View);
		Result.bDynamicRelevance = true;
		Result.bShadowRelevance = false;
		Result.bEditorPrimitiveRelevance = UseEditorCompositing(View);
		return Result;
	}
};

```

also, SetIsVisualizationComponent isnt needed if the component is meant to be more then just a visualization, I found it pointless because I’m just using this to visualize a component that has an actual impact on gameplay. This is set in a lot of other examples, so I’m just making a note of it here.

---

<div class="post-metadata">

**Author:** ![bendemott](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@bendemott](https://forums.unrealengine.com/u/bendemott)\
**Post date:** [October 21, 2023, 1:29am UTC](https://forums.unrealengine.com/t/how-to-use-fdebugrendersceneproxy/413562/4 "2023-10-21T01:29:46Z")

</div>

For anyone else that comes across this, check out this nice blog by some guy named “Steve” 😄

> **[UE4 Editor Visualisation Helper · SteveStreeting.com](https://www.stevestreeting.com/2021/09/14/ue4-editor-visualisation-helper/)**
>
> How to add editor visualisation to unselected objects in UE4? I solved a particular problem of mine in Unreal Engine this week, which was this:
> How do I visualise any custom information I want at edit time (not runtime), even when objects are not...

**For anyone else that finds this, a quick summary:**  
`FDebugRenderSceneProxy` is useful for rendering debug lines, cylinders, circles, etc in the editor, without needing to click the “play button”  
I’ve made use of this to show the bounds of a simulated object or constraint (like a spring on a car) while configuring it in the details panel.  
You can render debug lines in the viewport of a blueprint or in the main gameplay viewport.
