I’m rather new to Unreal Engine. Used to work with in-house engines and Unity before but we are now moving to Unreal for a new project.
For this I have created an Actor base class in c++ which I use to create subclasses with blueprints. I chose Actors instead of components because it is very integral to the objects.
However, to make editing these objects in the blueprint editor viewport easier I want to draw some lines and boxes in there. So far I only managed to draw lines in the scene view or in-game but I have no idea how to draw lines/boxes in the blueprint editor viewport.
I tried to use the ComponentVisualizer and the ActorVisualizer (from the Marketplace) but both only draw in the scene view.
Does anyone know how to do this? It would make setting up these actors way easier
I can’t help much, but would suggest you look at the line trace blueprint function. You could probably find some code about the implementation of their debug lines. This should help you on your way… they also have a box and sphere trace which you can look at.
I took a look but was able to solve it in the end by modifying the ActorVisualizer plugin a bit.
For anyone else stumbling upon this issue: I’m not sure if I can share the code publicly here, given that it is a paid plugin.
However, I had to modify “void FActorVisualizerModule::BindEditorDelegates()” to also add the mode tool to all newly opened FEditorViewportClients see GEditor->OnViewportClientListChanged() but you have to make sure that the editor is already initialized so put it into this event: FEditorDelegates::OnEditorInitialized.
The second modification you have to do is “TMap<const AActor*, TArray<TSharedPtr>> UActorVisualizerEdMode::GetVisualizers()”.
Here I just pass in the FViewport* Viewport, get its client, its world, check if the world is a preview world, if not use the previously code with USelection, otherwise, get the persistent level of the world, find the blueprint actor and test for valid visualizers on there.