How-To: Persist a Level Actor

Goal: go beyond the basics and control how a saveable level actor behaves when it is destroyed - stay gone, or respawn from the level - and understand the runtime-vs-placed distinction.

Prerequisites
You've done Quick Start: World Actors - the actor implements ICrimsonSaveableActor and its state is marked SaveGame. An active save slot exists. This page picks up from there.

Implementing ICrimsonSaveableActor and marking fields SaveGame is the whole opt-in - see Quick Start: World Actors for the images and code. Everything below is optional refinement on top of that.

1. Destruction is tracked automatically

The world subsystem listens for actor destruction on the server (including Destroy() and lifespan expiry), so a deleted saveable actor stays deleted with no manual call. A runtime-spawned actor simply has its save entry removed. A placed (level) actor reloads from the map every session, so a tiny GUID-only tombstone is written to keep it gone.

No manual call needed
You don't need to call anything when a saveable actor is destroyed - the automatic handler covers collected pickups, expired projectiles, and anything else that calls Destroy(). OnActorDestroyed(this) is an optional manual hook (e.g. to force an immediate flush with bSaveWorldStateAfterEveryChange). See the full matrix in Concept: World State & Identity.

2. (Optional) Let a destroyed placed actor respawn

By default a destroyed placed actor never comes back. To make it respawn from the level after deletion instead, override ShouldRespawnAfterDestroyed to return true. (Runtime-spawned actors ignore this - once destroyed they simply stop being saved.)

In the actor Blueprint: override `Should Respawn After Destroyed` (from ICrimsonSaveableActor) and return a checked Boolean so the deleted placed actor reappears from the level on load.
Verify
Default (false): destroy the actor, save, reload - it stays gone, and the save file does not grow for runtime actors. With the override returning true, a destroyed placed actor is back after reload.
Multiplayer: SaveGame is not Replicated
The value is restored on the server only; clients see it only if the property is also Replicated (or RepNotify). Full explanation: Concept: Multiplayer & Player Scoping.

See also

  • How-To: Save Cross-Object References - persist pointers between saved actors
  • How-To: Configure Auto-Saving - control when world state is captured and flushed
  • Concept: World State & Identity - the capture, identity, and deletion model