How to carry over actors between levels?

Hi, I’m looking to have the character travel to another level with a weapon in their hands. The weapon is an actor with variables in the BP that you can pick up and use but when traveling to another level it disappears. I have the player stats and weapon actor references in the game instance BP and the player stats will carry over like XP, Level, and Health but not the weapon Im holding. Not sure what to do as I thought the actor references would carry over like the other variables. Any ideas or help would be greatly appreciated!

When a level is destroyed, it destroys all actors it had inside as actors cannot exist without a level. So you need to save the state of your actor inside a UObject that is not level bound, then you recreate your actor and pass your saved state to a new actor.

1 Like

Thanks for the reply, this is exactly what Im looking for though I do have another question; how do I create this uobject and make it not bound to a level? Is there a setting in Project Settings? Or on a blueprint? Tried looking at the docs but it’s not clear to me how to create this.

You can create a class inherited from UObject just as all other blueprints, just inherit from Object when creating a new blueprint class.

In this class you store whatever you need to store.

Then you choose which object shall construct an instance of this class and keep a ref to it (you can choose same UGameInstance as you did, since its life cycle is not bound to Level). Inside this object you call ConstructObjectFromClass (select your new class as an argument), then reference it inside a variable. As long as your new UObject is referenced in a variable, it will live.

You can, of course, just keep saved state variables right inside your GameInstance, but thats not clean imho).

If you use seamless travel you can specify which Actors to persist across levels. See Travelling in Multiplayer | Unreal Engine 4.27 Documentation “Persisting Actors across Seamless Travel”