How do I make a Loading Screen?

Hi
I’ve noticed that when I run my game, textures are not completely loaded, they show low res and then they load completely
so, How can I preload all my assests so this doesn’t happen?
I want to have like a loading screen and then start playing once assets are loaded

I’m using Blueprint so I want to do it in blueprint

thanks for your help

1 Like

I’ve noticed Shooter game has a loading screen, is all done in C++ so I’ve been trying to figure it out but no luck so far, please Help, even if it’s on C++

I know this is fairly old, but has no answer so I thought I’d bump it with a comment.

I too am needing to figure out loading screens, since currently my game starts with all low res geometry and textures, which all pop in and frame rate tanks for a couple seconds before going up once loading has finished.

Definitely need a loading screen to hide this.

Hey,

project you probably want to take a look at for reference, if you’re using Blueprints, is Swing Ninja. It doesn’t detect when textures are finished loading, unfortunately, and that’s not something you can set up in Blueprints currently, but you can do something serviceable with a Delay node.

Blueprints to look for are LoadscreenMask, which is load screen itself, and BP_SimpleLevel_Select, which sets up load screen.

Hope that helps!

Regarding a C++ version of a Loading Screen, this is how I solved issue with UE 4.4:

“Movie Player” is supposed to be used for Loading Screens. Instead of a movie it can also just display some Slate-widgets.

Set up Loading Screen just before you trigger loading level (e.g. via ServerTravel) like this:

FLoadingScreenAttributes LoadingScreen;

LoadingScreen.bAutoCompleteWhenLoadingCompletes = true;
LoadingScreen.WidgetLoadingScreen = FLoadingScreenAttributes::NewTestLoadingScreenWidget(); // <-- test screen that comes with UE

GetMoviePlayer()->SetupLoadingScreen(LoadingScreen);

I put this into a Blueprint Library so it can be used by Game Designers, too.

Now comes tricky part regarding pre-loading of streaming textures. documentation states Streaming System will finish streaming all textures before returning control to Movie Player which then dismisses Loading Screen. However I checked engine sources and this is not case! So you will still end up with textures being streamed in while game is already running.

workaround to this is to manually call

IStreamingManager::Get().StreamAllResources( 10.0f ); // <-- adjust your timeout!

during “Begin Play” of your next Game Mode or Level. I also put this into a Blueprint Callable Function, so Game Designers can completely handle Loading Screens.

Marc

Edit:

As of UE 4.6.1 there is still a potential crash if you use text widgets in your loading screen. I fixed problem and submitted a pull request that can be used if you run into that problem: https://github.com/EpicGames/UnrealEngine/pull/799

1 Like

Try this if you are looking for a simple loading screen using blueprint, It works perfect…

You can add background behind Loading page if you like to.

Hey Marc, this is very interesting, can you show how did you put this in a Blueprint Library , please? I’m trying to get that work with no success, I’m still using 4.4 version, and I can’t update to 4.5 for now

That is just a graphic on top, has nothing to do with how much of level is actually loaded and no events when is done, which is what would be great to have, not just a fake thing.

So far that’s best option - I was about to post exact same solution but was beaten to it.

Hey mkamradt,

Did you have to do anything specific on top of this to make it not crash when quitting game? If I use your loading screen solution, and later quit to main menu, then quit/close game itself, I crash. (It seems to be a series of functions alien to me, starting with movie player’s destructor).

Oh well, triggered by discussion I just put my solution to work at more places in our game and then also noticed some problems I did not have with UE 4.4. I got it working again but I actually needed to modify engine source. I will open up a support ticket for that change and will get back to this topic as soon as I have more information.

Regarding Blueprint Function Library:

You basically derive a class from UBlueprintFunctionLibrary and add static functions that are specially marked with UFUNCTION() macros.

For example:

UCLASS()
class UFatBullBlueprintLibrary : public UBlueprintFunctionLibrary
{
	GENERATED_UCLASS_BODY()

	public:
		UFUNCTION( BlueprintCallable, Category = FatBull )
		static void FatBullShowLoadingScreen();
		UFUNCTION( BlueprintCallable, Category = FatBull )
		static void FatBullStreamAllResources();
}

This function will then show up globally in your Blueprints.

Use it like this: Just before your call to “Open Level”, call “Show Loading Screen”. first thing in your new level’s “Begin Play” event handler should then be “StreamAllResources”.

Marc

Hi. Just want to find out if a node has been exposed yet to blueprints that will allow us to look for texture streaming finished or completed?

Hi Crocopede,

Not yet, but we do have a feature request in our system for it (UE-7707). I’ll let you know if I see any updates on it.

Really glad to hear that it’s in request. I hope this isn’t too low down, priority-wise, since it’s a pretty important feature. Though using delay nodes is certainly achievable (my current game uses this) - you don’t really want to force player to wait longer than game actually needs to load.

Hey mkamradt - Just want to touch base with you here about whether or not this has been resolved internally on engine or if an engine change is still necessary? We’re running 4.7 and I don’t want to be changing it if fix has already gone in.

Thanks in advance!

last time I checked this was for 4.7.3 and I did not see any code that explicitly frees movie player.

However you may just get away without change since crash depends on order of global objects being freed by compiler. So just give it a try to quit your application and if it works compiler “accidentally” put it in correct order. If not, you could try to apply my pull request.

Marc

for 4.8 which approach would be better for loading screen?
c++ or bp?

I saw loading screen tutorial. And I try it. But it is not work. I don’t know what I miss. I set game instance and I check running my code, but it is not show me movies. Here is my code.

void UGameInstanceEx::Init()
{
Super::Init();

FCoreUObjectDelegates::PreLoadMap.AddUObject(this, &UGameInstanceEx::BeginLoadingScreen);
FCoreUObjectDelegates::PostLoadMapWithWorld.AddUObject(this, &UGameInstanceEx::EndLoadingScreen);

}

void UGameInstanceEx::BeginLoadingScreen(const FString& in_levelName)
{
FLoadingScreenAttributes LoadingScreen;
LoadingScreen.bAutoCompleteWhenLoadingCompletes = true;
LoadingScreen.WidgetLoadingScreen = FLoadingScreenAttributes::NewTestLoadingScreenWidget();
LoadingScreen.MoviePaths.Add(TEXT(“/Game/Movies/LoadingMovie.LoadingMovie”));

	GetMoviePlayer()->SetupLoadingScreen(LoadingScreen);
	//GetMoviePlayer()->PlayMovie();

}

What am I miss?

1 Like

If someone stumbles over this topic in this time…

just put the Path after Movies/ WITOUTH EXTENSION as path…
example: LoadingScreen.MoviePaths.Add(TEXT(“myVideo”));

Took me Hours to find out

1 Like

Lol… so You play loadig screen, and then load the level?