Level Streaming: Move from MainMenu to World level

Hello,

I have MainMenu level, it’s empty(main menu widget only). MainMenu and World levels have separate characters (menu pawn and ingame character with inventory, etc.). World level is split into chunks(level streaming).

How can I load World with level streaming and then spawn player in specific chunk(i have player location saved in savegame)? And then return to main menu via clicking “Return To Main Menu” button. I’ve found nothing helpful enough.

XadE

UGameplayStatics::OpenLevel works well, but it blocks game’s main thread. Is it possible to OpenLevel without freezing?

XadE

Okay, I’ve finally written something serviceable.

Can you maybe post how you make this?
Other People have maybe the same problem and it can help if you share your knowledge about it.

Hello,

Easier solution:

GetWorld()->GetTimerManager().SetTimer(loadingscreenTimerHandle, this, &UMasterUI_Menu::New_Game, 5.0f, false);
UGameplayStatics::OpenLevel(this, TEXT("StreamTest"), true, "");

You can execute UGameplayStatics::OpenLevel() with delay if you know how long your animation is. It’s good solution if your loading screen is video file, or something like that. But it will increase loading times.

Better solution:

You can put everything in one persistent level with World Composition and load separate chunks manually(if your level is not big, splitting into chunks is optional). So, if you launch the game only persistent level is loaded(with menu pawn and menu widget). And if you’ll click “New Game” you’ll UGameplayStatics::LoadStreamLevel() everything you need. It won’t freeze the game because level streaming doesn’t block main game thread, so it’s easy to setup animated loading screen there. But character must be spawned and possessed manually.

XadE