Im trying to save actors that get destroyed so they stay destroyed whenever the game is closes out







This is all my code for this. However nothing seems to happen once I pick it up and log back into the game. The actor is still there and I have to re delete it.

where are you loading the save game when the game starts?

game instance is not a save game…that cast in begin play should fail

my bad Im loading it in the level blueprint.

so is working now?

No I have no idea why

tried to print the contents of the array when loading to make sure save is working?

nothing seems to be off

I actually followed a youtube video here it is Save And Load If An Actor Is Destroyed - Unreal Engine 4 Tutorial - YouTube

From your bluprints it looks like you don’t destroy saved actors after you load game (you have to destroy them again on every game load).

Also try this tutorial, it’s good (watch at 1.5x speed):

1 Like

So if after load game do I get a reference from that actor in the world level bp then destroy actor?

Did a quick test in hope it might help. The tricky part of this is to get a fixed ID per actor instance that’s automatically generated and persistent between Play sessions.

  • This is the collectible actor:
    Construction Script


    Guid is unique for every UObject and is generated on every play, but it’s highly unlickly two actors will have same GUID no matter how many times you hit Play. So it’s safe to assume we can use the Actors GUID to assign a unique string in Construction, this will not rewrite next time construction runs because the string will no longer be empty.
    Event Graph

  • Save Game Blueprint: only the set to be used to store strings
    image

  • Game instance Event Graph

  • These are the functions used in Game Instance
    SG_AddDestroyedActorAndSave


    SG_DestroyedActorsOverwrite

    SG_IsDestroyedActorInSet


Result:
SaveLoadDestroyedActors

There is a video that implements this on the official Unreal Engine channel but couldn’t find it. In this video it was used to save a random seed so Constructor wouldnt change a random generated forest.

About Set containers: Blueprint Sets | Unreal Engine Documentation

Hope it helps.

1 Like

thanks for everyones support