How to add ComponentVisualizer to Custom module?

Spring Arm draws debug red line from it’s origin to desired camera location ( arm length * direction )
I looked at source code for that component but can’t find out how to draw similar line for my own component.

As I understand I need to register my visualizer class at
FComponentVisualizersModule

with

void RegisterComponentVisualizer(FName ComponentClassName, TSharedPtr Visualizer);

But I don’t understand how to do that.

Also I got an errors when I try to implement my own subclass of FComponentVisualizer and include ComponentVisualizer.h.

like:
Source\Editor\UnrealEd\Public\ComponentVisualizer.h(38): error C2061: syntax error : identifier ‘FLevelEditorViewportClient’

May be I should wrap my code in some #if WITH_EDITOR or something ?

1 Like

You can use the Draw Debug Line function.

44429-drawdebugline.png

That’s awesome, Thanks !

Ok, It works now.

First I should do is add custom editor module

here is wiki how to do it

and inside it module implement custom ComponentVisualizer.