[PLUGIN] Savior

How to Setup Procedural Actors Spawned at Runtime to Auto Save & Load:

An Actor, or Component, you are spawning at Runtime will be saved as usual.
However loading them back is a complex task because we cannot control whatever ID the internal engine will assign to a runtime spawned Object.
Often the new Object’s ID will be random internal pointer that used to reference another object; to overcome this obstacle to Save & Load “Procedural Actor” properly, your Procedural Class is required to implement three things:

  • Implement the “SAVIOR_Procedural” Function Interface.
  • Include a “Guid” Property to its Variables List, named “SGUID”.
  • In its Construction Script, call a special node called “Make SGUID”.

Those three simple steps above will guarantee your Procedural Class will be loaded correctly from Slot’s Data without mismatching Data with another instance of your Class also spawned in Runtime, turning them into Absolutely Identifiable Procedural Objects. So…

IMPORTANT:

First, within desired Procedural Actor’s Blueprint, we have to implement our “Procedural” Function Interface:

Once that is done, we now have to create a “Guid” Property for the Procedural Class and name it “SGUID”:

The Property must be a Guid Struct named “SGUID”. Savior will ‘read’ the Property and expects it to be this type, otherwise it will be ignored.
The Property must be marked ‘Save Game’ tag to be visible to the Auto-Save System.

That been done, only step left now is making sure SGUID’s value is persistent and unique.
That would be a headache for you to do, so instead of trying to control its behavior, there’s a node that can do that for you within a Construction Script…

Add the “Make SGUID” node to your Construction Script Graph and assign its output value to the “SGUID” Property:

Do NOT use a default “New Guid” node! The Guids created by that aren’t persistent, it would break our logic.

And it’s done, your ‘Procedural Class’ is ready to be freely spawned in Runtime and be automatically respawned with it’s correct Property’s values restored once the Game is reloaded from a Slot.

More Info about IDs:
Understanding SGUID

1 Like