Move actors between levels c++

We have a feature where the player can carry objects. These objects live in compartmentalized streaming maps for performance reasons. The problem we are encountering now is when the player leaves an area that is streamed out and the object they are carrying disappears or crashes. Is it possible in C++ to move the actor to the persistent level? Then move it to whatever the current level is when it is released? If the latter doesn’t make sense we can leave in the persistent and delete it at a later time that it makes sense.

Our other option is to delete the carried actor when grabbed and spawn a new one in the level with the player to carry around. Any help would be appreciated it.

You can use seamless travel and in PlayerController::GetSeamlessTravelActorList() you can include what actor you want to pass over to next level here.

Same problem here. Our player is moving in a tiled world. They pick up a sword and it is attached to their hand socket.
When they walk a long way and the tile they picked up in unloads, the sword is deleted too.

Any sample code for this?

I’m not sure if this is the correct way to go about it, but I’ve used the following code to move actors between levels without destroying and re-spawning them.

	if (OldLevel == NewLevel)
	{
		UE_LOG(LogTemp, Warning, TEXT("MoveActorToLevel: Actor already exists in the level"));
		return;
	}


	World->RemoveActor(Actor, true);
	Actor->Rename((const TCHAR *)0, NewLevel); //Set the outer of Actor to NewLevel
	NewLevel->Actors.Add(Actor);
1 Like

hi , where to add this code ?

GetSeamlessTravelActorList is now read only. I tried adding to it but it doesn’t work. They might have changed this since 2015.

As of 2020 this seems to be the only way to do it. I’ve tried using game mode and GetSeamlessTravelActorList() but none work.