# Loading screen

**URL:** <https://forums.unrealengine.com/t/loading-screen/58941>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [March 21, 2016, 7:07pm UTC](https://forums.unrealengine.com/t/loading-screen/58941 "2016-03-21T19:07:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mafiy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mafiy](https://forums.unrealengine.com/u/Mafiy)\
**Post date:** [March 21, 2016, 7:07pm UTC](https://forums.unrealengine.com/t/loading-screen/58941/1 "2016-03-21T19:07:52Z")

</div>

Hi  
I try to create function for loading level with displaying UMG Widget. But I do not Widget on screen during loading of level.  
Game is frozen and next loaded level appears.

```auto

ULoader* ULoader::DoLoad(TSubclassOf<UUserWidget> uWidget, FName loadLevel, FName unloadLevel, UObject* WorldContextObject, FLatentActionInfo LatentInfo)
{
if (UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject))
{
UUserWidget* Widget = nullptr;

if (uWidget)
{
Widget = CreateWidget<UUserWidget>(World, uWidget);
Widget->AddToViewport();
}
if (loadLevel.IsValid())
{
UGameplayStatics::LoadStreamLevel(World, loadLevel, true, false, LatentInfo);
}
if (uWidget)
{
Widget->RemoveFromParent();
}
if(unloadLevel.IsValid())
UGameplayStatics::UnloadStreamLevel(World, unloadLevel, LatentInfo);
}
return NULL;
}

```

But if I use blueprint then everything works ok.  
Blueprint:

 ![Untitled-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/9/b/9bec598ebd49c218a2587973d6cebee7bb875553.png)

---

<div class="post-metadata">

**Author:** ![Jambax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jambax/32/904177_2.png) [@Jambax](https://forums.unrealengine.com/u/Jambax)\
**Post date:** [March 21, 2016, 9:14pm UTC](https://forums.unrealengine.com/t/loading-screen/58941/2 "2016-03-21T21:14:02Z")

</div>

Bam.

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

---

<div class="post-metadata">

**Author:** ![Mafiy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mafiy](https://forums.unrealengine.com/u/Mafiy)\
**Post date:** [March 22, 2016, 10:23pm UTC](https://forums.unrealengine.com/t/loading-screen/58941/3 "2016-03-22T22:23:18Z")

</div>

> [@TheJamsh;497525](#):
>
> Bam.
> 
> [A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums](https://wiki.unrealengine.com/Loading_Screen)

Good plugin.  
I installed it. Delegate for PreLoadMap works OK.  
but delegate for PostLoadMap does not work and during load level I do not see load screen.

```auto

#include "PlatformTester.h"
#include <Runtime/MoviePlayer/Public/MoviePlayer.h>
#include "MyGameInstance.h"

void UMyGameInstance::Init()
{
    UGameInstance::Init();

    FCoreUObjectDelegates::PreLoadMap.AddUObject(this, &UMyGameInstance::BeginLoadingScreen);
    FCoreUObjectDelegates::PostLoadMap.AddUObject(this, &UMyGameInstance::EndLoadingScreen);
}

void UMyGameInstance::BeginLoadingScreen()
{
    FLoadingScreenAttributes LoadingScreen;
    LoadingScreen.bAutoCompleteWhenLoadingCompletes = false;
    LoadingScreen.MinimumLoadingScreenDisplayTime = 5;
    LoadingScreen.WidgetLoadingScreen = FLoadingScreenAttributes::NewTestLoadingScreenWidget();

    GetMoviePlayer()->SetupLoadingScreen(LoadingScreen);
    FString str = "TTT";
}

void UMyGameInstance::EndLoadingScreen()
{
    int32 p = 32;
}

```

---

<div class="post-metadata">

**Author:** ![Jambax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jambax/32/904177_2.png) [@Jambax](https://forums.unrealengine.com/u/Jambax)\
**Post date:** [March 22, 2016, 11:25pm UTC](https://forums.unrealengine.com/t/loading-screen/58941/4 "2016-03-22T23:25:59Z")

</div>

Strange, should work fine.

You using this in Standalone or in PIE? PIE may not work.

---

<div class="post-metadata">

**Author:** ![Mafiy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mafiy](https://forums.unrealengine.com/u/Mafiy)\
**Post date:** [March 23, 2016, 9:29pm UTC](https://forums.unrealengine.com/t/loading-screen/58941/5 "2016-03-23T21:29:56Z")

</div>

After reloading UE4 load screen is started work. As I understood Load Screen works only for load game, but it does not work if I map is loaded by clicking button(“Start Game”).  
Is some method for Load Screen if map if loaded by clicking button(“Start Game”) ?

---

<div class="post-metadata">

**Author:** ![Jambax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jambax/32/904177_2.png) [@Jambax](https://forums.unrealengine.com/u/Jambax)\
**Post date:** [March 24, 2016, 3:13pm UTC](https://forums.unrealengine.com/t/loading-screen/58941/6 "2016-03-24T15:13:54Z")

</div>

Yeah it just binds to the Core Delegates, so as long as the level is opening it should work.

It may not work as expected in editor, try build out to standalone and trying that.
