USaveGame and serializing the minimum necessary info

Got a couple questions on serialization and USaveGame


Say I have an AItem (AActor subclass) which has:

  • A gameplay ‘State’ property (an enum, which changes value throughout the game)
  • A ‘Asset’ property of type UItemAsset (UDataAsset subclass) for ‘static’ info on the item.

Now I want to persist this object between game sessions, including its gameplay state.

Should I create an AItem property in my USaveGame and it will automatically serialize both the ‘State’ and ‘Asset’ properties?

If so:

  • does this mean I should also manually set any other properties in the AItem to ‘Transient’ so they are not serialized?
  • does this mean a LOT of actor stuff will also get serialized anyway? (since AActor has a bunch of stuff in it).


Should I create an intermediate UObject, say UItem, which holds the ‘State’ and ‘Asset’ properties, have the AItem in turn have a property of this type (instead of it having the 2 properties)
and in the USaveGame, create a property of type UItem instead of AItem?

In either case, for instance for the ‘Asset’, should I manually do something so the path to the asset is saved as opossed to the UItemAsset itself? (i.e. make a string property instead in USaveGame with the path to the asset)