Course contentsShow
← Unreal Engine Game Development
Lesson 42 of 8801. Foundations and Editor WorkflowFree lesson

Managing Transient Data with Transient Specifiers

Use the Transient flag to mark properties that should not be serialized to disk, optimizing save game sizes and preventing unnecessary data persistence.

In this lesson, you will learn how to use the Transient specifier to prevent specific variables from being saved to disk, keeping your game files clean and efficient.

What is Transient Data?

In Unreal Engine, most UPROPERTY variables are automatically "serialized." This means when you save your game or save a level, the current value of those variables is written to the disk so that when you reload, your game is exactly where you left off.

However, sometimes you have data that is strictly temporary. For example, a CurrentFrameInputBuffer or a ProceduralNoiseSeed that you calculate every time the game starts doesn't need to be saved. If you save this data, you are unnecessarily bloating your save game files. This is where the Transient specifier comes in.

Using the Transient Specifier

When you add Transient inside your UPROPERTY macro, you are telling Unreal’s serialization system: "Ignore this variable when saving to disk." Upon reloading, Unreal will simply initialize this variable to its default value (like 0, nullptr, or false).

Here is how you implement it:

UCLASS()
class AMyCharacter : public ACharacter
{
    GENERATED_BODY()

public:
    // This variable persists across saves
    UPROPERTY(EditAnywhere)
    int32 TotalScore;

    // This variable will NOT be saved to disk. 
    // It is reset whenever the actor is reloaded.
    UPROPERTY(Transient)
    float CurrentFrameTimer;
};

Why use this?

  1. Save Game Optimization: By excluding unnecessary calculations or runtime-only states, your save files become significantly smaller.
  2. Preventing Stale Data: You avoid "ghost data" where a variable might hold an outdated value from a previous session that is no longer valid upon re-loading the game.
  3. Performance: The engine doesn't spend time reading and writing data that you don't actually need to persist.

Use Transient for anything that can—or should—be recalculated or reset the moment your actor is spawned or loaded into the world.

Key Takeaway: The Transient specifier marks a property as "runtime-only," ensuring it is excluded from serialization to disk to keep your game files lean and your state management predictable.