Navigation
API > API/Runtime > API/Runtime/Engine
Helper class to derive from to use debug draw delegate functionalities (i.e. DrawDebugLabels) The class will take care of registering a delegate to the UDebugDrawService and draw all FText3d provided by the scene proxy. This functionality only requires the derived classes to override `CreateDebugSceneProxy_.
It is also possible to add text from other sources of data from the scene proxy but that requires a few extra steps:
- create a class that inherits from `FDebugDrawDelegateHelper_
- override `DrawDebugLabels_
- add a method to be able to populate the source data from the scene proxy
ex: class FMyDelegateHelper : public FDebugDrawDelegateHelper { public: void SetupFromProxy(const FMySceneProxy* InSceneProxy) {
}; protected: virtual void DrawDebugLabels(UCanvas* Canvas, APlayerController*) override { }; private: TArray SomeData; }; - Within the component inheriting from `UDebugDrawComponent_
- add a property of that new helper type in the component inheriting from `UDebugDrawComponent_
- override `GetDebugDrawDelegateHelper_ to return that new member as the new delegate helper to use
- and then use it in `CreateDebugSceneProxy_ before returning the created proxy. ex: class MyDebugDrawComponent : public UDebugDrawComponent { protected: virtual FDebugRenderSceneProxy* CreateDebugSceneProxy() override { FMySceneProxy* Proxy = new FMySceneProxy(this); MyDelegateHelper.SetupFromProxy(Proxy); return Proxy; } virtual FDebugDrawDelegateHelper& GetDebugDrawDelegateHelper() override { return MyDelegateHelper; } private: FMyDelegateHelper MyDelegateHelper; }
| Name | UDebugDrawComponent |
| Type | class |
| Header File | /Engine/Source/Runtime/Engine/Classes/Debug/DebugDrawComponent.h |
| Include Path | #include "Debug/DebugDrawComponent.h" |
Syntax
UCLASS (Abstract,
HideCategories=(Activation, AssetUserData, Collision, Cooking, HLOD, Lighting, LOD, Mobile, Navigation, Physics, RayTracing, Rendering, Tags, TextureStreaming),
MinimalAPI)
class UDebugDrawComponent : public UPrimitiveComponent
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UActorComponent → USceneComponent → UPrimitiveComponent → UDebugDrawComponent
Implements Interfaces
- IAsyncPhysicsStateProcessor
- IInterface_AssetUserData
- IInterface_AsyncCompilation
- INavRelevantInterface
- IPhysicsComponent
Derived Classes
UDebugDrawComponent derived class hierarchy
- UDataflowDebugDrawComponent
- UEQSRenderingComponent
- UGameplayDebuggerRenderingComponent
- UGeometryCollectionISMPoolDebugDrawComponent
- UISMPoolDebugDrawComponent
- UNavCorridorTestingComponent
- UNavMeshRenderingComponent
- UNavTestRenderingComponent
- UPathedPhysicsDebugDrawComponent
- UPCGDebugDrawComponent
- USmartObjectDebugRenderingComponent
- UZoneGraphAnnotationComponent
- UZoneGraphAnnotationTestingComponent
Functions
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FDebugRenderSceneProxy * CreateDebugSceneProxy() |
Method that derived class should override to create the scene proxy and customize a custom delegate helper (if any) | Debug/DebugDrawComponent.h | |
virtual FDebugDrawDelegateHelper & GetDebugDrawDelegateHelper() |
Method that should be overriden when subclass uses a custom delegate helper. | Debug/DebugDrawComponent.h |
Overridden from UPrimitiveComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FPrimitiveSceneProxy * CreateSceneProxy() |
Method overriden and marked as final since derived class should override `CreateDebugSceneProxy_ | Debug/DebugDrawComponent.h |
Overridden from UActorComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void CreateRenderState_Concurrent
(
FRegisterComponentContext* Context |
Used to create any rendering thread information for this component | Debug/DebugDrawComponent.h | |
virtual void DestroyRenderState_Concurrent () |
Used to shut down any rendering thread structure for this component | Debug/DebugDrawComponent.h |