Skip to content

How it works

EDITOR RUNTIME (cooked)
------ ----------------
AItemSpawnPoint (editor-only actor) --+
AItemSpawnPoint (editor-only actor) --+-- bake on --> UItemSpawnRandomizerComponent
AItemSpawnPoint (editor-only actor) --+ save/cook BakedPoints[] (transform + tags + id)
|
| OnRegister
v
UItemSpawnSubsystem (one per game world)
- shuffles each item's candidates
- reserves points (one item per point)
- teleports item before BeginPlay

Three classes do the work:

  • AItemSpawnPoint: an editor-only marker actor. One possible placement.
  • UItemSpawnRandomizerComponent: on the item. Holds the list of candidate points while you author, and the baked copy of their transforms and tags that ships.
  • UItemSpawnSubsystem: a world subsystem that exists only in game and PIE worlds. Assigns every item to a point.
  1. In a game world, each randomizer component registers with the subsystem from OnRegister, before world begin play.
  2. On world begin play the subsystem sorts the registered items by actor path, so processing order doesn’t depend on streaming order, and assigns them one by one.
  3. For each item it captures the current actor transform as the home transform, then:
    • If randomization is disabled (globally, per item, or the item has no baked points), the item stays exactly where it is.
    • Otherwise it builds the list of candidate indices, plus a “stay home” entry when Include Home Location is on, shuffles it with a random stream seeded from the session seed and the item’s name, and walks the shuffled list.
    • The first entry that is either “stay home” or a point no other item has reserved wins. The point is reserved, the actor is teleported (SetActorTransform, no sweep, ETeleportType::TeleportPhysics), and OnRelocated fires.
    • If every candidate point is already taken, the item stays home.
  4. Items that register after world begin play (streamed sublevels, actors spawned at runtime) are assigned immediately on registration, against the points still free.
  5. When an item unregisters (destroyed, streamed out), its point is released.

Because the teleport happens before actor BeginPlay, everything that reads the item’s transform in BeginPlay or later sees the randomized placement as if the item had always been there: pickup systems caching a respawn transform, AI, save systems, your own Blueprints.

The final transform of an item on a point:

Location / Rotation = (Rotation Offset, Location Offset) applied in point-local space, then the point's world transform
Scale = item's authored scale x point's scale
  • Pivot matters. The item’s actor pivot lands on the point. For a mesh with its pivot at the centre, place points at the centre of where the item should be, or fix it once with Location Offset (for example Z = half the item’s height) so every point can sit on the surface.
  • Rotate points, not offsets. Use point rotation for “this one lies on its side”. Use Rotation Offset only for an item-wide correction, such as a mesh imported facing Y instead of X.
  • Scale is a multiplier. Keep points at 1, 1, 1 unless you want a different size at one location.
  • Physics items. TeleportPhysics means simulated bodies arrive without carrying velocity from the move. Place points so the item rests on a surface: if it starts intersecting geometry, physics pushes it out on the first frame.
  • Trust the ghosts. They use exactly the same transform maths as the runtime, offsets included.

Each point carries a Gameplay Tag Container. Tags bake together with the transform, so after assignment the item can ask where it ended up with Has Assigned Point Tag or Get Assigned Point Tags.

Matching is hierarchical by default: Spawn.Drawer satisfies a query for Spawn. Pass bExactMatch = true for equality. Get Assigned Point Tags returns an empty container when the item stayed home.

Add tags in Project Settings → Project → GameplayTags like any other Gameplay Tag. Suggested conventions: Spawn.Drawer, Spawn.Shelf, Spawn.Floor, Spawn.Hidden, Spawn.Dark.

  • Global Seed = 0: each session picks a seed from the system clock, so every playthrough is different.
  • Global Seed ≠ 0: that seed is used every session, producing the same layout every time.

Each item draws from its own random stream, derived from the session seed and the item actor’s name. The batch pass processes items in actor-path order. Together this means:

  • The layout doesn’t depend on load or registration order within the batch pass.
  • Adding or removing an unrelated item that shares no points with an item doesn’t change that item’s result.
  • Items that share points interact through reservations: items earlier in path order claim first.
  • Renaming an item actor changes its stream.
  • Items arriving later (streamed sublevels) are assigned against whatever points are still free at that moment, so streaming order can matter for them.

Reproducing a tester’s layout: the seed is printed in the LogItemSpawn summary line every session and after every reroll. Copy it into Global Seed and play. At runtime it’s also available from Get Session Seed. Reroll All always picks a fresh random seed, even when Global Seed is set.

The point actors never ship, so their data has to live somewhere: it is baked into each item’s component as BakedPoints (point id, world transform, tags).

The bake is refreshed when:

Trigger Notes
The item’s component registers in the editor Opening the map, construction script reruns.
The item is saved Covers map saves and cooking, so a cooked build always ships the bake as it was at cook time.
Any property on the component is edited, or undo/redo
Refresh Spawn Previews is pressed

Moving or editing a point does not refresh it. Ghosts follow points live, but the item’s bake updates only on one of the triggers above. In a classic single-file level, saving the level saves the item too, so the next save fixes it. With World Partition / One File Per Actor, moving a point dirties only the point’s own package, and the item’s bake stays as it was until the item is touched.

Rule of thumb: after moving points, press Refresh Spawn Previews on the affected items and save.

Safety rules built into the bake:

  • A bake is never replaced by an empty one unless you emptied the Spawn Points list yourself.
  • Points that are referenced but not loaded at bake time (unloaded sublevels) keep their previous bake entry instead of being dropped.

While a level is open in the editor, every item with Show Spawn Previews on draws ghost copies of its meshes on each of its points.

  • What is drawn. Every visible, non-editor-only Static Mesh component on the item, with its relative transform preserved, so multi-mesh items preview correctly. Skeletal meshes and instanced static meshes on the item are not previewed.
  • Live. Ghosts rebuild when points or items are moved, deleted or edited in the Details panel (including while dragging values), and on undo/redo.
  • Clickable. Clicking a ghost selects the item it belongs to.
  • Harmless. Ghosts have no collision, cast no shadows, are never saved into the map, never appear in the Outliner and never exist in PIE or cooked builds.
  • Material. Set Preview Material Override to a translucent material if the ghosts read too much like the real item.

Ghosts are owned by one central editor subsystem rather than by the item, and every rebuild starts from a full wipe. Stale or duplicated ghosts can’t happen: after construction script reruns, Blueprint recompiles and undo transactions, the preview always reflects the current level.

Compiling an item Blueprint makes the editor replace every instance of it in the level, and editor-only per-instance data like the Spawn Points list doesn’t survive that on its own. The plugin restores the list one tick after the compile from the baked data (which stores each point’s path) and rebuilds the ghosts. Points in sublevels that aren’t loaded are restored too. The same restore runs when a map loads. If the log says “restored N spawn point reference(s)”, this is what happened.

Cooked build

  • Per item: one array of baked entries (one FTransform, one FName and one tag container each).
  • Per point: nothing. The marker actors are stripped.
  • No tick anywhere in the system.
  • One assignment pass at world begin play: a shuffle of a handful of indices and one teleport per item. Unmeasurable in practice, even with hundreds of items.
  • Randomization off (globally or per item): the item’s home transform is recorded and nothing else happens.

Editor

  • Ghosts are instanced static meshes: one draw call per source mesh per item, regardless of the number of points.
  • Ghost rebuilds run only on edits to relevant actors (points and items), not every frame.
  • The editor subsystem doesn’t exist in PIE or game worlds, so play-in-editor performance is unaffected.
  • The server decides. Assignment runs on the server and in standalone or listen-server games. Clients assign nothing, and Reroll All is ignored on clients.
  • The item must replicate its movement. Clients receive the randomized placement only through normal actor replication. Level-placed items that should be randomized in multiplayer need Replicates and Replicate Movement enabled. A non-replicated item stays at its authored location on clients while the server has moved it.
  • OnRelocated fires on the server only. If clients need to react to the point tags, replicate the result yourself, for example a replicated tag container set from the server’s BeginPlay.
  • The layout is server-random per session; with a fixed Global Seed it is also reproducible on the server.