Plugin Documentation

PrefabKit
Reusable, nestable, randomizable prefabs

Turn a selection of level actors into a prefab asset, place it anywhere, nest prefabs inside prefabs, roll weighted random variations from a seed, and let players build with prefabs at runtime.

v1.0
UE 4.27 & 5.8
Win64 (verified)
Category Editor
Alpha XP

Overview

PrefabKit adds prefabs to Unreal Engine 4.27 and 5.8. A prefab is an asset that stores a group of actors together with their properties and their transforms relative to a pivot. A APrefabKitActor placed in a level builds those actors as its attached children. Edit the children of any instance, save them back to the asset, and every other instance in the level is rebuilt.

  • Create a prefab from the current selection with one click; a thumbnail is captured automatically.
  • Nested prefabs: a prefab can contain other prefab actors.
  • Prefab collections: weighted lists of prefabs; each placed actor picks one entry from its own seed.
  • Randomizer and Seed Linker actors for re-rolling a whole level or a chosen set of prefabs.
  • Blueprint and C++ API to spawn, randomize, re-assign and unlink prefabs at runtime.
  • Runtime construction system: ghost cursor, snap points for floors, walls and objects, build and remove tools, a build menu widget and save/load of player-built levels.

Requirements

RequirementDetails
Unreal Engine4.27 and 5.8 (verified clean on both)
ModulesPrefabKitRuntime (Runtime), PrefabKitEditor (Editor), PrefabKitEditorPostInit (Editor), PrefabKitConstructionRuntime (Runtime), PrefabKitConstructionEditor (Editor)
DependenciesNone (engine modules only; no other plugins are enabled)
LanguageBlueprints and C++
PlatformsNo platform restriction in the plugin descriptor. Win64 is the platform built and verified by Alpha XP; other platforms are supported by the code, not verified by Alpha XP.

Installation

  1. Install PrefabKit from Fab into your engine, or copy the PrefabKit folder into your project's Plugins folder.
  2. For a C++ project, regenerate project files and build the editor target.
  3. Open the project, enable PrefabKit in Edit > Plugins and restart the editor.
  4. C++ only: add the modules you use to your Build.cs, for example PublicDependencyModuleNames.Add("PrefabKitRuntime"); and, for the construction system, "PrefabKitConstructionRuntime".
Verifying the installA PrefabKit button appears in the level editor toolbar, Project Settings > Plugins > PrefabKit exists, and right-clicking selected actors in the viewport shows Create Prefab (from selection).

Quick start

Create and place a prefab (editor)

  1. In the Content Browser, select the folder where the new asset should go.
  2. Select a few actors in the level and click PrefabKit > Create Prefab (from selection) in the toolbar (or right-click in the viewport).
  3. A prefab asset is created and the actors are attached under a new APrefabKitActor.
  4. Move, add or change child actors, select the prefab actor and press Save Prefab to Asset in the Details panel.
  5. Drag the prefab asset from the Content Browser into the level to place more instances.

Spawn a prefab at runtime (Blueprint)

  1. Add a variable of type UPrefabKitAssetInterface (object reference) and set it to a prefab or prefab collection.
  2. Call Spawn Prefab with a world context, the asset, a transform and a seed.
  3. Use the returned prefab actor with Randomize Prefab, Set Prefab Asset or Unlink Prefab.

C++

// Build.cs: PublicDependencyModuleNames.Add("PrefabKitRuntime");
#include "Utils/PrefabKitFunctionLibrary.h"
#include "Asset/PrefabKitAsset.h"
#include "Prefab/PrefabKitActor.h"

// In AMyActor: UPROPERTY(EditAnywhere) TSoftObjectPtr<UPrefabKitAssetInterface> PrefabToSpawn;
void AMyActor::SpawnRoom()
{
    if (UPrefabKitAssetInterface* Prefab = PrefabToSpawn.LoadSynchronous())
    {
        APrefabKitActor* Room = UPrefabKitBlueprintLibrary::SpawnPrefab(this, Prefab, GetActorTransform(), /*Seed*/ 1234);
        if (Room)
        {
            FRandomStream Stream(42);
            UPrefabKitBlueprintLibrary::RandomizePrefab(Room, Stream); // pick new variations and rebuild
        }
    }
}

Editor workflow

Toolbar menu and context menus

WhereEntryWhat it does
Toolbar > PrefabKitCreate Prefab (from selection)Creates a prefab asset in the selected Content Browser folder (or /Game) from the selected actors. Actors that already belong to a selected prefab and actors without a root component are skipped.
Toolbar > PrefabKitLink selected Prefab Collection seedsLists the APrefabKitSeedLinker actors in the level; picking one adds the selected prefab actors to its Linked Actors.
Toolbar > PrefabKitUser GuideOpens this documentation.
Toolbar > PrefabKit > AdvancedUpgrade assets to latest versionUpgrades every prefab asset in the project to the current data version. Make a backup first.
Viewport right-clickCreate Prefab (from selection)Same as the toolbar entry.
Content Browser right-click on prefabsCreate Prefab CollectionCreates a collection that contains the selected prefabs.
Content Browser right-click on prefabsRecapture ThumbnailRenders the thumbnail again with the thumbnail camera settings.
Content Browser right-click on prefabsUpgrade to latest versionShown only for assets saved with an older data version.

Details panel buttons

Selected actorButtons
Prefab Kit Actor using a prefabSave Prefab to Asset, Save Prefab to New Asset, Load Prefab from Asset, Randomize, Unlink
Prefab Kit Actor using a collectionRandomize (new seed), Reload Prefab; the Seed is editable here
Prefab Kit RandomizerRandomize (switches the viewport to Realtime when the build is spread over frames)
Prefab Kit Debug ActorSave Actor Data, Load Actor Data (serialization test helper)
Selecting inside a prefabClicking an actor that belongs to a prefab selects the outermost prefab actor first; clicking again steps one level down the hierarchy. When a map is opened, outdated prefab actors in it are rebuilt from their assets.

Prefab assets & actors

NodeTypeDescription
UPrefabKitAssetAssetPrefab asset (shown as "Prefab"). Stores the actors, their properties and relative transforms. Properties: Event Listener, Replicates.
UPrefabKitAssetCollectionAssetPrefab collection (shown as "Prefab Collection"). Prefabs is a list of Prefab Asset + Weight entries; Custom Thumbnail replaces the thumbnail when the asset is saved.
UPrefabKitAssetInterfaceClassCommon base of both asset types; use it for variables that accept either.
APrefabKitActorClassActor that builds a prefab. Its root UPrefabKitComponent holds the Prefab asset reference; Seed chooses the collection entry.
APrefabKitReplicableActorClassVariant used by Spawn Prefab when the asset's Replicates option is set; it only enables standard actor replication for the prefab actor itself.
Load PrefabCallableRebuilds the child actors from the prefab asset.
Save PrefabCallableWrites the current child actors back into the prefab asset (editor workflow).
Is Prefab OutdatedPureTrue when the asset changed since this actor was last built.
Get Prefab AssetPureReturns the prefab this actor builds; for a collection, the entry selected by the actor's seed.
Randomize SeedCallableDraws a new seed from a random stream, optionally for nested prefabs too (does not rebuild).
UPrefabKitEventListenerClassBlueprintable class assigned to a prefab asset's Event Listener.
Post SpawnEventCalled on a new listener instance after the prefab and all its child prefabs have been spawned and initialized.

Blueprint library

Static nodes in UPrefabKitBlueprintLibrary (category PrefabKit).

NodeTypeDescription
Spawn PrefabCallableSpawns a prefab actor for a prefab or collection at a transform, applies the seed and builds it. Returns the prefab actor.
Randomize PrefabCallableGives the prefab and its nested prefabs new seeds from a random stream and rebuilds them.
Unlink PrefabCallableDetaches the child actors (they stay in the level) and destroys the prefab actor.
Get All Attached ActorsCallableReturns every actor attached below an actor, recursively.
Set Prefab AssetCallableAssigns a prefab or collection to a prefab actor and optionally reloads it.
Find Top Most Prefab ActorCallableReturns the outermost prefab actor that an actor is attached under, or none.

Randomization

NodeTypeDescription
APrefabKitRandomizerClassActor that re-rolls prefabs in its level. Properties: Randomize On Begin Play (off), Seed Offset (0), Max Build Time Per Frame (0.02 s; spreads the rebuild over frames), Fast Sync Build (off), Actors To Randomize (empty = every prefab in the level).
RandomizeCallableSeeds the randomizer, re-rolls the top-level prefabs, applies seed linkers and rebuilds.
On Randomization CompleteEventBroadcast when the rebuild started by Randomize has finished.
APrefabKitSeedLinkerClassActor whose Linked Actors all receive the seed of the first linked prefab when the randomizer runs.

Construction system

The construction system lets players place and remove prefabs at runtime. Add a UPrefabKitConstructionComponent to your Player Controller, assign Build Menu UI (for example ConstructionSystem/UI/PKBuildMenu) and Build Menu Data (a UPrefabKitConstructionUIAsset), and place UPrefabKitConstructionSnapComponent components inside the prefabs players can build.

Input mappings

The component binds these legacy input names (add them under Project Settings > Input):

NameKindAction
PrefabKitModeToggleActionEnter or leave construction mode
PrefabKitToggleBuildUIActionShow or hide the build menu
PrefabKitModeToolBuildActionSwitch to the build tool
PrefabKitModeToolRemoveActionSwitch to the remove tool
PrefabKitBuildAtCursorActionPlace the cursor prefab
PrefabKitCursorItemNext, PrefabKitCursorItemPrevActionCycle collection variations of the cursor prefab
PrefabKitCursorRotateAxisRotate the cursor prefab in steps
PrefabKitRemoveAtCursorActionRemove the prefab under the cursor
Collision setupCreate an object collision channel named PrefabSnapChannel and a collision preset named PrefabSnap (query only, overlapping PrefabSnapChannel). Snap components use the PrefabSnap preset; without the channel, traces fall back to WorldStatic and snapping does not work.

Construction component

NodeTypeDescription
UPrefabKitConstructionComponentClassPlayer Controller component. Properties: Cursor Material, Cursor Invalid Material, Trace Start Distance (1000), Trace Sweep Radius (40), Construction Camera Actor, Construction Camera Transition Time (0.15), Construction Camera Transition Exp (1.0), Build Menu UI, Build Menu Data.
Toggle Construction SystemCallableEnables construction mode with the active tool, or disables it.
Enable Construction SystemCallableBlends to the Construction Camera Actor (when one is set) and activates the given tool (Build Tool or Remove Tool).
Disable Construction SystemCallableDisables the active tool and blends back to the controlled pawn.
Show Build MenuCallableAdds the build menu to the viewport, switches to game-and-UI input and pauses tool input.
Hide Build MenuCallableRemoves the build menu and restores game input.
Set Active ToolCallableSwitches between the build and remove tools.
Get Active Tool TypePureReturns the active EPrefabKitConstructionToolType.
Get Active ToolPureReturns the active tool object.
Get ToolPureReturns the tool object for a tool type.

Tools

NodeTypeDescription
UPrefabKitConstructionBuildToolClassShows a ghost of the active prefab at the cursor, snaps it to snap components, tints it with the invalid material when it overlaps existing geometry or exceeds the slope limit. Properties: Trace Distance (4000), Cursor Rotation Step Angle (15).
Set Active PrefabCallableSets the prefab or collection the build tool places.
UPrefabKitConstructionRemoveToolClassHighlights and removes the prefab under the cursor. Property: Trace Distance (4000).

Snapping

NodeTypeDescription
UPrefabKitConstructionSnapComponentClassBox component placed in buildable prefabs. Properties: Snap Type (Floor, Wall, Object), Floor Constraint (AttachX/AttachY/AttachZ and their negative sides), Wall Constraint (AttachTop, AttachBottom, AttachLeft, AttachRight), Align To Ground Slope, Use Max Ground Slope Constraint, Max Ground Placement Slope (60).
APrefabKitConstructionSnapClassActor wrapper around a snap component, for placing snap points directly in a prefab.

Build menu

NodeTypeDescription
UPrefabKitConstructionUIAssetAssetData asset for the build menu: Menu Title and Categories (Display Name, Icon, Prefab Entries with Display Name, Tooltip, Icon, Prefab).
UPrefabKitConstructionBuildUIClassInterface the build menu widget must implement.
Set UI AssetEventReceives the Build Menu Data asset when the menu is created.
Set Construction SystemEventReceives the construction component that owns the menu.

Saving player-built levels

NodeTypeDescription
Save Construction System LevelCallableSaves every prefab placed by the construction system (asset, seed, transform) and optionally the player's transform and control rotation to a save slot.
Load Construction System LevelCallableOpens a level and passes the save slot and user index as level options (PrefabKitSlot, PrefabKitUserId).
Handle Construction System Level LoadCallableCall after the level has loaded (on the server); reads those options, rebuilds the saved prefabs and restores the player.
UPrefabKitConstructionSaveGameClassSave game object used by the nodes above.

Settings

Project Settings > Plugins > PrefabKit (stored in DefaultPrefabKit.ini).

SettingDefaultDescription
Pivot PositionCenterWhere the pivot of a new prefab is placed: Center, Extreme Left or Extreme Right of the selection bounds (always on the bottom of the bounds).
Allow Dynamic UpdateOnWhen a prefab is saved, rebuild the other instances of it in the level.
Ignore Bounding Box For ObjectsDraw Frustum ComponentClasses ignored when prefab bounds are computed (restart required).
Default Thumbnail Pitch-11.25Thumbnail camera pitch for new prefab assets.
Default Thumbnail Yaw-157.5Thumbnail camera yaw for new prefab assets.
Default Thumbnail Zoom0Thumbnail camera zoom offset for new prefab assets.

Content

AssetTypePurpose
ConstructionSystem/UI/PKBuildMenuAssetWidget Blueprint: ready-made build menu that implements the build UI interface and lists the categories and prefabs of the Build Menu Data asset.
ConstructionSystem/UI/Support/PKBuildMenu_CategoryInfo, PKBuildMenu_PrefabInfoAssetBlueprint list-item objects used by the build menu.
ConstructionSystem/UI/Support/PKBuildMenu_CategoryItemUI, PKBuildMenu_PrefabItemUIAssetWidget Blueprints for one category / one prefab entry in the menu.
ConstructionSystem/UI/Textures/LevelBounds_64x, ObjectLibrary_64xAssetDefault menu icons.
PrefabTool/Materials/M_PKCursor, M_PKCursor_Inst, M_PKCursor_InvalidLocationAssetGhost cursor material and its valid / invalid placement instances (use them for Cursor Material and Cursor Invalid Material).
PrefabTool/Sprites/Icon_48, Icon_48_linker, Icon_48_randomizerAssetEditor sprites for prefab, seed linker and randomizer actors.
PrefabTool/Icons/*.pngImage filesEditor toolbar and class icons loaded by the plugin's style set.

Troubleshooting

SymptomCause and fix
Create Prefab is disabled or creates nothingAt least one actor must be selected. Actors without a root component, and actors that already belong to a selected prefab, are skipped.
Other instances do not change after Save Prefab to AssetAllow Dynamic Update is off in the project settings. Turn it on, or press Load Prefab from Asset on each instance.
An asset is labelled "Prefab (upgrade required, right click)"It was saved with an older data version. Right-click it and choose Upgrade to latest version, or use PrefabKit > Advanced > Upgrade assets to latest version.
The randomizer appears to stop half way in the editorWith Max Build Time Per Frame above 0 the rebuild runs over several frames; the editor switches the viewport to Realtime so it can finish. Set Max Build Time Per Frame to 0 to rebuild everything in one frame.
Construction input does nothingThe component must be on the Player Controller and the input names listed above must exist in the project's input settings.
The ghost cursor never snapsThe PrefabSnapChannel object channel or the PrefabSnap preset is missing, or the prefab has no UPrefabKitConstructionSnapComponent.
The build menu never appearsBoth Build Menu UI and Build Menu Data must be set; the widget must implement the build UI interface (an error is logged otherwise).
Spawn Prefab returns nothingThe world context did not resolve to a world, or no prefab asset was passed. Pass self from an actor and a valid prefab or collection.

Credits

© 2026 Alpha XP — alphaxp.net · Support: support@alphaxp.net. Built and verified for Unreal Engine 4.27 and 5.8.