x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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.)

Product Version: UE 4.19
Tags:
more ▼

asked Jul 14 '18 at 08:39 PM in Blueprint Scripting

avatar image

enakops
11 1 4

avatar image GrumpyNZ Aug 01 '18 at 01:35 AM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question