Add custom class to Mode-window category

92809-bp.png

How can I tell UE4 to mark my classes as “Lights” or as custom categories like “Doors”, “Enemies”, etc?

I looked at the Class Specifiers | Unreal Engine Documentation but there was no option for it that I could find. And ClassGroup:

UCLASS(ClassGroup = "Enemies")
UCLASS(ClassGroup = "Basic")

is not the proper one. I also restarted UE4 just in case.

Hey -

It would be possible to add a custom class to the Modes panel however to do so would require editing the engine’s source code. If you look at the SPlacementModeTools::CreateStandardPanel() function you can find a list of display elements that correspond to the list in the Modes tab. It should be possible to add a draggable asset widget with your class to the list, however it implies no non-engine classes, so your class would need to be added to the engine.

Cheers

Thanks for the detailed answer. I’m using the pre-compiled version of the engine so I can sadly not do that. I’ll either have to change my ways then or wait and hope that someday we may get a UCLASS property (or something) to accomplish that.

Hey,

I know I am a little bit late to answer this, but looking at the code (v 4.22) you can extend
the modes categories and items without modifying the engine source code via PlacementModeModule. The module provides two functions: RegisterPlacementCategory and RegisterPlaceableItem which can be called in your plugin/module startup functions.

Also you should call respective unregister methods in shutdown method of your module.

edit:
Ok, so I implemented this in my project and it took a while to figure it out finally. Basically you subclass an UActorFactory and create a specific factory for your entry in which you specify the display name and class of the spawned actor. Also you can add some funcionality by overriding some exposed methods like Pre/PostActorSpawn. You need to add this factory to the GEngine->ActorFactories array. Then you can create FPlaceableItem with a reference to the static class of the factory.

The point of registering the factory was the part I’ve been stuck at for a few hours. Hopefully this will help someone.

Hi, thanks for your insights mate. Could you post some screenshots or info on how to do all that you mention? Is it possible to do it through a plugin without modifying the ActorFactories Array?

Thanks!