Reparent Spawned actor to different streaming level

Here’s our situation: An actor spawned into the world can be spawned into the streamed level as its parent and then be removed from this streamed level as the player travels to a different part of the world. That means when that level is unstreamed the actor will be unstreamed with it. Where this gets complicated is that say you craft a weapon at the furnace in the main map - this is being spawned in the main map. If you bring it over to a streamed level like our cave systems, drop it, and leave - it’s going to stay behind, parented to the main map, and when that streamed level ceases to exist it will fall forever and be lost

By default all actors spawned at run-time are spawned into the ‘overworld’ though or rather whatever the main level is. The opposite is also true. If a streamed level has a cool axe in it and you bring it home, when that streamed level ceases to exist that axe is getting despawned.

So the question is, is there any way to do this currently with UE4?

There is two possible ways to reparent an actor:

  1. Just change a package of your actor using UObject’s Rename method (It can change object’s Outer). This method possibly can broke some registrations made by the SpawnActor function.
  2. Use SpawnActor to spawn your actor’s clone inside the desired level and then remove old actor instance. To clone an actor you can specify your old actor as a template argument of SpawnActor. To select a new level you can use OverrideLevel. (You can use PersistentLevel as ‘Overworld’. To access it just use GetWorld()->PersistentLevel )

But there is extra trouble with items lying on streaming levels. When your level will be loaded again all items you placed in the editor will be respawned because you can’t and shouldn’t save ingame changes on a disk. Usually these problems is solved by creating a special class “Prop” which just gives an actual item to a player, and all items is bounded to them player owner or inventory or something else which will survive between transactions. To prevent respawning items your prop class can request some persistant object which keep tracking eaten items.
So, your crafted custom items just should never been streamed out.