Saving/loading questions.

My current plan is pretty much everything that needs to be saved inherits from a DynamicActor class.
On save, all objects of this class call their own SaveInfo method that can be overridden by children to add more info that not all objects need (like info about what plant is being grown in objects that can grow plants).
On load a boolean LoadingGame is set, all objects in the save that belong in the current level but aren’t there already are spawned in the Level’s BeginPlay event, and DynamicActors on BeginPlay will change their state if LoadingGame is true (including destroying themselves if they aren’t in the save).

So far it seems to be working but can you see anything wrong with this plan that can’t be fixed?

  • How do I know when it’s finished loading so I can set LoadingGame to false? If I don’t do this anything that spawns in the world will be immediately destroyed. What’s the last thing that happens when a level is opened?
  • Is there a way to reparent built-in classes (I guess the right one would be Pawn) to DynamicActor so they can be saved without repeating myself? It’s not too much trouble for the player but for enemies I would need an array similar to the other DynamicActors.
  • I am saving/loading the FirstPersonCharacter without doing the above, and it works fine on a basic testing level but on my PersistentLevel when I load, I get an extra pawn that spawns where I saved and the one I’m controlling just spawns in the default state. Why?

I thought it might be bringing in a player from one of the other levels I don’t actually want. I moved those to another folder so World Composition doesn’t add them as sublevels but it’s still happening.

ok, removing the pawn from the world fixes the extra pawn on load, but always spawns me at 0,0,0 when I’m not loading because no PlayerStarts are found, even though there is one in Level1.

This just prints None, twice for some reason.

Removing the Default Pawn Class from the game mode and putting the pawn in the level starts and loads me in the right places with no extra pawn, but loading removes my UI…

Well I fixed part of that. A cast I didn’t need was failing so I just removed it, but my Main UI widget does need a character reference so parts of my UI still don’t work. Why is GetPlayerCharacter not working when I load the game this way (in the Construct event of the widget, which is being created in the BeginPlay event of the HUD)?