It looks like you are serializing the SGUID property.
It should not be serialized in your level. They should be generated at runtime (yet the value unique and persistent).
I was indeed serializing it, but removing that SaveGame macro did not resolve the problem. Which function should I use to generate the SGUID:
SGUID = USavior::CreateSGUID(this);
or
SGUID = USavior::MakeActorGUID(this, EGuidGeneratorMode::ResolvedNameToGUID);
EDIT: Seems like it works when I call SGUID = USavior::MakeActorGUID(this, EGuidGeneratorMode::ResolvedNameToGUID);
in PostInitProperties() except the constructor. Any idea why?
That’s a Unreal Engine architecture thing.
Not really plugin related.
You might want to make a forum search about the differences between Blueprint classes and “real” cpp classes.
Several serialization gotchas can get developers trapped with them.
Thanks! I will read up on it a bit. I also seem to have resolved the problem now by initializing Destroyed
to false
like this in my header file:
UPROPERTY(SaveGame)
bool Destroyed = false;
I believe when uninitialized it got removed by Savior on load.
The SGUID
now also works when using USavior::CreateSGUID()
in the constructor as intended. Previously I had to resort to USavior::MakeActorGUID()
and do it in PostInitProperties()
for it to work.
EDIT: Nevermind, it still has this random behaviour where duplicate instances get removed.
If your actors are placed in the world, you can make the SGuid editable and generate a new value from the Details Panel of the duplicated actor.
Hi, I recently bought the plugin and there are things I struggle with.
I’m creating a roguelike game that works with small rooms (each room is a level), and I want to use this plugin to save each room’s state when the player leaves the room, and restore it when he enters again.
I’m trying to use the Save Level and Load Level functions, they work fine when I’m still inside the level, but loading a level in another level doesn’t do anything, the operation is successful but it doesn’t change the level.
Am I doing this the right way?
Sorry for my bad english
Another question about saving scope:
I have two character classes, AMainCharacter
and AEnemy
which both use the same actor component member variable. But I would like to only save this member for the AMainCharacter
but not for AEnemy
.
If I add that actor component class to the scope of the save slot, it saves for both, the AMainCharacter
and AEnemy
, even though AEnemy
is not saved as it is not in the actor scope.
The level must be “open”, and loaded to memory for actor data to load from the slot.
You can add Component Tag !Save
and !Load
to your AEnemy’s component.
Thanks a lot, I got it working.
I’m still new to how saving works in game dev so I’ll probably have some more questions lol!
Hello,
Is it possible to erase all memory from a savior slot after each program execution? I tried using the “new slot instance” but it keeps loading data from the last program execution.
Sorry if this question has already been answered.
There are nodes to delete/erase save data.
If you save an empty slot, the file on disk will also be erased.
Hello,
I’m a bit lost with level saving/loading.
I have a button that saves the level (ennemies, pickups etc…) and another one that loads it.
Everything works fine as long as I start my game inside this specific level, I’m able to move in other levels and when I comeback I can load the level the way it was before I left.
But if I start my game in another level, then go into this level (the one with the buttons) and save it, loading it again doesn’t do anything (even if goes into the success section).
I don’t know if I’m doing this the right way, my idea is to have a slot for each level that the player goes into and being able to load it again everytime he comes back.
Sounds like you are just overwriting old save data in files.
Most of the time, reading a save file to an slot object before saving it solves this problem.
Hi, I’m trying to implement a save/load function using:
[SAVIOR] Load Game World (Async)
[SAVIOR] Save Game World (Async)
Save Game World works, but nothing happens if I try to load the save (after restarting the game).
I wanted to save/load the actor’s locations and variable values.
Is this a known issue? What can I do?
Thanks
I’m having some trouble saving my local player subsystem. I’ve saved GameMode, World, GameInstance and even Save/Load object, but the data inside the subsystem won’t save.
I’ve labelled the property (An array of a struct) as SaveGame.
Subsystems are a new thing in the engine and they are not part of the Game Mode framework.
Although you can still use “Save Object” node to save it, you are the first I ever see trying to save subsystems objects.
I can add this as a future expansion of the plugin, but no promises right now.
Subsystems have been in the engine since 2019, especially player controller subsystems. Though I do think it is fair to say I might be one of the first few people to try this, very few people use subsystems since they are tied to C++, and I don’t think many people are trying to save anything inside them.
I tried the “Save Object” and “Load Object” node and they didn’t seem to work.
Did you set ‘SaveGame’ UProperty flag on your C++ variables?
On the demo project you can search BPs for these nodes, I believe there’s an example tied to a keyboard keypress on demo character blueprint.
Yeah I’ve added that UProperty flag. I’ll take a closer look at the demo project in case there’s a step I’m missing