Vehicle unloads when level unloads

Hiya,

I’ve been working on a hobby project for sometime, and I ran across a problem which finally figured out the answer to.

I start the game as a police officer in the police station. I want the character to be able to get into a cruiser and patrol/drive to other locations.

I didn’t know how to do this, but I figured almost all of it out. World composition: Done! Importing of the vehicle: done! Physics asset: done! Possessing the car: Done! Unpossessing the car, repossessing the original pawn: Done!

However, when I drove to specific locations in the world, the car disappeared, and the game stopped responding to input. After two months of debugging (errr… two months because I’m otherwise employed, and I don’t have 100% free time to devote to debugging), I finally figured out what was going on.

The car was part of the first level loaded in the world composition. When that level unloaded itself, so did the car. I added a PrintString node to the “EventUnpossessed” node of the car to verify that’s what was happening.

So, after all of that explanation, my question is: Is there anyway within blueprints (or C++; I am proficient in C++) to move a pawn from a sublevel to the persistent level, so that it doesn’t unload (and hence force an unpossession event) when it’s original sublevel unloads.

In the mean time, I’ve simply moved the car to the persistent level, so there should be no shenanigans. I tried it, and holy cow, it actually worked.

What I’m concerned about is that I might, later in development, spawn a car as part of some procedural generation, and then have it unload on the player because I wasn’t careful about where it loaded in when I spawned it.

Moving it from “Sublevel A” to “Persistent Level” as part of the “event possessed” call might nip that possibility in the bud.

Alternatively, is there any way to tell the vehicle to spawn into the persistent level, rather than the sub level?

Thanks in advance!

edit: (P.S.: One of the reasons why I asked this, including the long-winded explanation is that I’m guessing that someone might run into a similar problem, and I wanted to leave a searchable record of how I solved the problem.)

Yep same problem.

Just a note, making the vehicle always relevant helped the problem too (in addition to being in P-level in the case of multiplayer).

Unfortunately today the problem reappeared for me and i’m at a loss as to why.