Reconstructing serialized actors

I’m trying to serialize an actor and create copies of it at runtime, but I seem to be running into an issue where it doesn’t appear in the level hierarchy until you refresh it by switching what the hierarchy should be looking at.

Here’s a visual representation of what’s happening.

This is my actor in the level, it has 3 static meshes and a child actor.

I’ve got a bind in the level blueprint which calls the saving of the actor and recreating of the actor, though, when I trigger it, I still see no change.

Until I switch over to a different view


Now I can just flip flop back to default and it will appear in the world outliner, as follows. Except as you can see, it’s not visible.

Until I move it while not being possessed.

Any reason why this would be happening?

Any insight is welcome

Got a little bit more insight into this, after spawning the actor, I was able to make it render properly, the moment I added “MarkComponentsRenderStateDirty()” to the actor.

However, making the actor move via “SetActorLocation()” still does not move the components of the actor until you select that actor in the level. It feels like none of the static mesh components are “Welded” ? or attached to the RootComponent? It feels like they become attached only after selecting the actor in the level while un-possessing.

I’ve even explicitly set the static mesh components to Reregister themselves after being deserialized, as well as made sure to call “UpdateComponentTransforms()” on the actor.

Managed to fix this issue, based off of my previous comment, it occurred to me that my component was indeed being rooted to the parent object that was initially being serialized upon deserialization. Lo and behold, that was the case.

Since my goal was to be able to serialize an actor and create copies of it in the level, never thought about the references that serialized components keep if you just serialize all of their data indiscriminately.

So, to fix my issue, I had to do a few things.

  1. Make sure that upon deserializing the component I was attaching it to the spawned actor’s root component
  2. Make sure the spawned actor re-registers all components
  3. Make sure to mark the spawned actor’s components as render state dirty

This is NOT an issue if you first destroy the actor you serialized. I wanted to keep all actors around though, including the original and manipulate them all individually.

If you see issues with my solution, let me know how I can improve on it.