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 the assets are loaded

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

thanks for your help

I’ve noticed the 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 the frame rate tanks for a couple seconds before going up once loading has finished.

Definitely need a loading screen to hide this.

Hey,

The 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.

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

Hope that helps!

Ben Halliday

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

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

Set up the Loading Screen just before you trigger loading the 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 the Game Designers, too.

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

The 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 the Game Designers can completely handle the 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 the problem and submitted a pull request that can be used if you run into that problem: https://github.com/EpicGames/UnrealEngine/pull/799

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

You can add background behind the 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 the 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 the 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 the best option - I was about to post the 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 the game? If I use your loading screen solution, and later quit to the main menu, then quit/close the game itself, I crash. (It seems to be a series of functions alien to me, starting with the movie player’s destructor).

Oh well, triggered by the 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 the 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 the 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”. The 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 the player to wait longer than the 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 the engine or if an engine change is still necessary? We’re running 4.7 and I don’t want to be changing it if the fix has already gone in.

Thanks in advance!

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

However you may just get away without the change since the crash depends on the order of global objects being freed by the compiler. So just give it a try to quit your application and if it works the compiler “accidentally” put it in the 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 the 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?