Variable's Transient vs SaveGame property

I’m having a hard time understanding what the Transient and SaveGame properties of variables actually do. Documentation says:

SaveGame
This Specifier is a simple way to include fields explicitly for a checkpoint/save system at the property level. The flag should be set on all fields that are intended to be part of a saved game, and then a proxy archiver can be used to read/write it.

Transient
Property is transient, meaning it will not be saved or loaded. Properties tagged this way will be zero-filled at load time.

So based on that it seems to me that Transient is the opposite of SaveGame but since those are two different properties it cannot be that. So what’s the difference?

Also what would happen if a variable would be marked as both Transient and SaveGame at the same time? Based on the above description it would mean it would save and not save at the same time :thinking:

Here some example !

Where to use a Transient variable. - Programming & Scripting / C++ - Unreal Engine Forums

Transient variable - Epic Games Forums

1 Like

I read those but they don’t answer my question. Especially that most answers are like “I’m not sure but I think…”.

There is serialization support for properties that don’t have saveGame on them. You just tell the FArchive to do so, and all properties are serialized.
Transient properties make sure properties can never be saved.

And obviously FArchives with SaveGame flag will only go for SaveGame properties.

SaveGame and Transient on the same property is interesting, im not sure what happens if you do that.

So if your building savegame code for your game is safe to not have to tag sensitive stuff transient, because a savegame FArchive just looks for SaveGame property.

And if using a non savegame FArchive that saves everything, you tag stuff Transient you don’t want saved.