Create UBoxComponent within editor

Hi guys, I’ll sum up my scenario: I want Actor A to move randomly inside the limits of a volume.

To do that, I have an Actor with:


UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Movement)
UBoxComponent * MovementVolume;

and a few functions that handle movement, it works fine. When I instantiate a blueprint of this class, I am able to click on a dropdown menu (called MovementVolume) and create a UBoxComponent on the fly, and place it wherever I want using a properties panel.

However, I want to improve the usability of it by allowing the designer to instantiate a volume beforehand, and selecting that previously created volume from that dropdown. That volume could be placed using gizmos (current implementation doesn’t allow for that, don’t know why), and referenced by other functions, for example.

Do you know how could I approach this? My thoughts are: a) there is a way to create a UBoxComponent in the editor and place it using gizmos/give it a name/etc; b) change the UBoxComponent to something else (to what?) that will allow me to do the same.

Any help is appretiated! Thanks

A simple way would be making a generic box volume actor that does nothing and only has a UBoxComponent with no collision and a billboard component that’s hidden in game for easy selection in editor. Then on your other actors that want to know about the volume instance you can add:



UPROPERTY(EditInstanceOnly)
AMyBoxVolume* LimitingVolume;


All the instantiated volumes in the same level as the actor will appear in the drop down on the details panel. The reason it’s EditInstanceOnly is because blueprint defaults shouldn’t reference objects outside itself.