Before you can save anything, you must add a BP_DtArchivesMaster to your persistantLevel, do never add a second one.
This object is needed because it contain all cached data, generated objects, settings etc. You’ll use it for manage your savegame system.
Everytime in all tutorials, when you see “setting”, it is in this actor often called “master”.
What you’ll do in this tutorial is called “manual way”, because objects you’ll serialize aren’t IElement. It’s important to see this way because it help to understand but you’ll prefere implement IElement for flexibility and remote serialization.
In reality it’s a SerializeElement node but that would not be understandable at first, it’s why we called it SerializeObject.
Add a deserializeObject node to your event beginPlay and a SerializeObject node to your event EndPlay.
It is already done in the BP_Light, do it in the BP_door.
For each (de)serialize nodes there is an object pin, it is the object that will be (de)serialized.
This pin is default to self even if you don’t see [self], you cannot see it because UE doesn’t handle objects for this, only actors. But it work anyway.
An archive is an object that represent a file.
An ArchiveID is a struct that identify an archive.
You can see it as a path to the file containing data.
An Element can be more than an object (using IdeepSaver) but we’ll see that later. For now see an element as a representation of an object in file.
An ElementID is a struct that identify an object, it contain an ArchiveID and is an identifier, it contain all informations for access the file representation of an element.
You cannot change properties of any identifier but you can create them a lots of way, just search “ToElementID” or “ToArchiveID” in blueprint (or drag the ElementID pin out and search “To”) or use autoconversion by draggin for exemple a string to an elementid (we cannot do that for array).
When you create an ElementID you’ll always have 2 pins, the top one is the archiveID and the bottom one is the ElementID itself.
Do not use hash for manual saving like in this tutorial.
– Connect your newly created ElementID to both serialization nodes.
– forceLoad to false,
– saveArchive to true.
You want to save the “IsOpen” boolean, select it, open the advanced detail panel and :
– set SaveGame to true.
Now you’ll need to add UpdateDoorFromIsOpen right after the deserialization node for change of the bool to be reflected to the door.
Compile, save and hit play.
Your door is now saved.
In short :
– One DtArchivesMaster in the persistant level.
– Set saveGame to true on properties you want to save.
– An identifier per element.