2 Min. read

How to Customize the UE5 Place Actors Panel

While working on a project or a custom plugin in Unreal Engine it can be useful to add custom actor classes to the Place Actors panel. This is my custom panel for The Bug Squad, which I’ll be using as an example for this post:

A screenshot of the custom category in the UE5 editor

First, the PlacementMode module should be added as a dependency in the editor module’s build.cs file. Here’s mine:

BugSquadEditor.build.cs
using UnrealBuildTool;
 
public class BugSquadEditor : ModuleRules
{
    public BugSquadEditor(ReadOnlyTargetRules Target)
        : base(Target)
    {
        // [...]
 
        PrivateDependencyModuleNames.AddRange(new[]
        {
            "BugSquad",
            "Core",
            "CoreUObject",
            "Engine",
            "PlacementMode",
            "SlateCore",
        });
    }
}

Custom categories and classes can then be registered inside the module’s C++ file:

BugSquadEditorModule.cpp
// [...]
 
#include "Player/BSPlayerStart.h"
#include "BSTestCameraActor.h"
#include "IPlacementModeModule.h"
 
void FBugSquadEditorModule::StartupModule()
{
    // Create a custom category and register it
    const FPlacementCategoryInfo Info(
        INVTEXT("Bug Squad"),
        FSlateIcon(FAppStyle::GetAppStyleSetName(), "PlacementBrowser.Icons.Basic"),
        "BugSquad",
        TEXT("BugSquad"),
        100
    );
 
    IPlacementModeModule& PlacementModeModule = IPlacementModeModule::Get();
    PlacementModeModule.RegisterPlacementCategory(Info);
 
    // Add actor classes to the category
    PlacementModeModule.RegisterPlaceableItem(Info.UniqueHandle,
        MakeShared<FPlaceableItem>(nullptr, FAssetData(ABSTestCameraActor::StaticClass())));
    PlacementModeModule.RegisterPlaceableItem(Info.UniqueHandle,
        MakeShared<FPlaceableItem>(nullptr, FAssetData(ABSPlayerStart::StaticClass())));
}
 
void FBugSquadEditorModule::ShutdownModule()
{
    // Unregister the custom category when the module is shut down
    if (IPlacementModeModule::IsAvailable())
    {
        IPlacementModeModule::Get().UnregisterPlacementCategory("BugSquad");
    }
}

And that’s all it takes!

It should also be possible to add Blueprint classes in addition to C++ classes to the new custom category, but I haven’t tried it yet. It also looks like the system supports creating completely custom UI for it (via FPlacementCategoryInfo::CustomGenerator), which might be useful for advanced use cases.