Download

CreateInstance is causing entire editor to freeze on exiting game

Greetings!

I have the following blueprint function:

I’m using it to spawn instances of a level, like this:

single instance.png

When I’m executing this function all seems to work alright, as long as I’m passing Locations along X axis, for example: (1000, 0, 0), (2000, 0, 0), (3000, 0, 0) and such. When I pass anything along Y axis, like (0, 1000, 0), the level does not spawn, and as soon as I close the game the entire editor stops responding. There’s no error in log and debugging the blueprint also didn’t report anything wrong.

What’s even stranger, the crash doesn’t happen always, but only if the Y-offset level is loaded in any other order, but the first.

Few examples:

  1. levels spawned from (0,0,0) and then along X axis

  2. single level spawned along Y axis

  3. level spawn on Y axis and then 3 more spaned along X axis

If more than 1 level is spaned along Y axis, the editor stops responding. If a level is spawned along Y axis in any other place than first in the chain, the editor stops responding, too.
In those scenarios, only the first level will spawn. Even in a situation when the Y-align level would be, for example, 4th in the chain, only first level will spawn and the editor will freeze when the game is closed.

No, I don’t really believe that it’s indeed the problem of axis, but that’s the simplest way from me to explain the problem. For the life of me I cannot figure out what could be causing a problem like that, though.

I’ve attached a LevelSpawning.zip archive with an example project.

I hope someone will be willing to explain what’s it is I’m doing wrong.

Yes, doesn’t seem to work, does it? ( I tried a lot of things ).

How about:

https://docs.unrealengine.com/en-US/…ame/index.html

?

You’re of course right - Load Level Instance (by Name) works correctly. Thank you a lot!

And here I come with news I found a scenario that causes the editor to crash instead just freeze and output some logs to help with the debug :smiley:

So I take it this is a known problem with CreateInstance and I just supposed to know to use a different function or did I missed some hint or instruction in the documentation?

I didn’t know about it until now. What does it say in the log?

Here’s the scenario that is causing the crash:

The crash message states:
Assertion failed: Level->GetCachedLevelCollection() == this [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/Engine/Private/World.cpp] [Line: 266]

Call stack:
UE4Editor_Core
UE4Editor_Core
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
kernel32
ntdll

And the “crashed” thread:

<Thread>
<CallStack>ntdll 0x000000004baf0000 + 9be14 KERNELBASE 0x0000000049350000 + 226ee UE4Editor-Core 0x0000000029370000 + 56ed1d UE4Editor 0x000000003d3e0000 + 33f6f VCRUNTIME140 0x0000000024050000 + e390 ntdll 0x000000004baf0000 + a10ef ntdll 0x000000004baf0000 + 4b474 ntdll 0x000000004baf0000 + 4b1c5 KERNELBASE 0x0000000049350000 + 23e49 UE4Editor-Core 0x0000000029370000 + 56ec66 UE4Editor-Core 0x0000000029370000 + 572048 UE4Editor-Core 0x0000000029370000 + 2fe52d UE4Editor-Core 0x0000000029370000 + 2897c5 UE4Editor-Core 0x0000000029370000 + 28bb00 UE4Editor-Engine 0x00000000d6ad0000 + 169a6f3 UE4Editor-Engine 0x00000000d6ad0000 + cbfe29 UE4Editor-Engine 0x00000000d6ad0000 + cccde4 UE4Editor-Engine 0x00000000d6ad0000 + 16af968 UE4Editor-Engine 0x00000000d6ad0000 + 167aced UE4Editor-UnrealEd 0x00000000fea20000 + 9d67d3 UE4Editor-UnrealEd 0x00000000fea20000 + 99ba0e UE4Editor-UnrealEd 0x00000000fea20000 + 45bce5 UE4Editor-UnrealEd 0x00000000fea20000 + d337e6 UE4Editor 0x000000003d3e0000 + 7800 UE4Editor 0x000000003d3e0000 + 1ba7c UE4Editor 0x000000003d3e0000 + 1bb5a UE4Editor 0x000000003d3e0000 + 2e31d UE4Editor 0x000000003d3e0000 + 3145a KERNEL32 0x000000004b500000 + 17034 ntdll 0x000000004baf0000 + 4cec1</CallStack>
<IsCrashed>true</IsCrashed>
<Registers />
<ThreadID>1560</ThreadID>
<ThreadName>GameThread</ThreadName>
</Thread>

Sorry, not allowed to upload full log files (I’m guessing because they contain Login ID and alike). But I sent those to Epic.
If you would like to see some other specific pieces of logs, just ask.

Hmm, as informative as most crash logs… :-/

Yeah. I took a look at the source code, but it’s nothing obvious.

What’s crashing is the check() in



void FLevelCollection::RemoveLevel(ULevel* const Level) { if (Level) {
  [INDENT=2]check(Level->GetCachedLevelCollection() == this);
Level->SetCachedLevelCollection(nullptr);
Levels.Remove(Level);[/INDENT]
  }
 }


I don’t have an environment to debug the entire Unreal Engine, but maybe Epic will take a look at it one day :wink:

Anyways, thanks again for letting me know abut Load Level Instance (by Name) - it should work just fine for my purpose.

Thank you for your help.

You’re welcome :slight_smile: