[4.8.1] Crash when destroying pawn and unloading streaming level instance at same time

Hell there,

I think I’ve stumbled onto an unusual bug. I have a dungeon generator that uses level streaming to put together pre-made chunks. At end of dungeon I issue a command to set all level streaming instances I’ve made to unload and destroy current player pawn.

Both these commands work fine separately but if I ask it to do both (no matter what order or with a delay between them) editor locks up and unreal engine crashes out. I don’t know how easy it is to replicate since project has grown quite large.

Hi

Please and attach log from your project after this crash occurs. You can find this in your project’s Saved\Logs folder. Thanks!

Here you go

Edit:Forgot this . of folder

It appears to be an accessed none error involving ProjectLevelGameMode, in Minimap Trigger Update. My guess is you’re trying to access information that no longer exists from either level instance or pawn after other is destroyed. If you put a breakpoint in your Blueprint where you unload level instances and player pawn, you can probably pinpoint exactly where problem is occurring.

I can’t really see what’s causing this in particular, however, without seeing project. If you’d like to upload it somewhere and give me a download link, I can take a look. You can do so privately via PM on forums, if you’d prefer:

Thanks!

thanks for having a look I just had a check too but that minimap trigger update error has been present for a long time and still occurs even if I remove logic that crashes game so I don’t think it is to blame. I’ll upload project and send you a link and some information on how to replicate results.

Just to make sure I went ahead and fixed minimap trigger update issue but I still get crash when unloading levels and destroying player pawn.

Hey

Thanks for project! I see same crash occurring, and I’ve entered a bug report for crash (UE-17740). I’m not certain what developers will be able to do with it, however, because I suspect it’s a garbage collection issue that’s tied to your order of operations; it’s likely something is being garbage collected at just right moment for pointers to get all screwy, and it’s making things explode.

Your suggested solution of unpossessing pawn and putting a delay in before destroying pawn is not far from what you’ll need to do. A potentially safer method is to do a check inside your SpawnPlayer event to see if previous pawn is null, and if it isn’t, destroy that actor first. In TouchedFinish event, set previous player variable to Current Player value, set its CharacterMovement > Gravity Scale to 0.0 (so it doesn’t fall below killz while you’re waiting to load up level), and then use Set Actor Hidden In Game on Current Player. This lets your pawn survive, hidden, while rest of your next level is set up, then it’s destroyed right before next pawn is spawned.

Anyway, hope that workaround helps. I’ll let you know when I see any updates on bug report. Thanks!

1 Like

Thanks for your input it’s good to know It’s not just me being screwy in some way! I’ll take your suggestions on board and get a more functional work around in place.

Thanks a bunch!

Hey, just wanted to let you know that engineers have fixed whatever was causing crash with your setup, and this should no longer happen once 4.9 is released. Until then, you’ll need to stick with workaround you’ve implemented. Thanks again!

That’s great new, thanks again for your help!