Download

Movie - Loading screen little fix [~4.14]

Hey!
You probably have seen already tutorials about it but i will give you example, so i can maybe help someone :slight_smile:
Big thanks to @TheJamsh for this thread: https://wiki.unrealengine.com/Loading_Screen
You can find there all things you need but i had to update some code to make it work :slight_smile:

Follow all things from the link above.
Now it’s time to ,update" and little help you :slight_smile:

[FONT=Arial Black]1. Ini

1) Do it by config

First let’s jump into .ini file
Go to Project/Config/DefaultEngine.ini
And put these 2 lines



[/Script/EngineSettings.GameMapsSettings]
GameInstanceClass=/Script/MyGame.MyGameInstance


GameInstanceClass is the name of GI class which we want to override by our class
MyGame = project name
MyGameInstance = our class name

2) Do it by editor

Edit->Project Settings->Maps & Nodes->GameInstance and pick your **GameInstance **class

[FONT=Arial Black]2. Code
After u made all these GI classes you will probably get error with .AddUObject
As i’m using 4.14 version i needed to replace to this code:



#include "YourProjectNameHere.h"
#include "Runtime/MoviePlayer/Public/MoviePlayer.h"
#include "Engine.h"
#include "MyGameInstance.h"



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

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

void UMyGameInstance::BeginLoadingScreen(const FString& MapName)
{
	FLoadingScreenAttributes LoadingScreen;
	LoadingScreen.bAutoCompleteWhenLoadingCompletes = false;
	LoadingScreen.bMoviesAreSkippable = true;
	LoadingScreen.MinimumLoadingScreenDisplayTime = -1;
	//LoadingScreen.MoviePaths.Add(TEXT("quest5")); /*This is the movie name*/
	LoadingScreen.WidgetLoadingScreen = FLoadingScreenAttributes::NewTestLoadingScreenWidget();

	GetMoviePlayer()->SetupLoadingScreen(LoadingScreen);
}

void UMyGameInstance::EndLoadingScreen()
{
}


Header file



#pragma once

#include "Engine/GameInstance.h"
#include "MyGameInstance.generated.h"

/**
 * 
 */
UCLASS()
class MULTIPLAYERGAME_API UMyGameInstance : public UGameInstance
{
	GENERATED_BODY()
	
public:
	virtual void Init() override;

	UFUNCTION()
		virtual void BeginLoadingScreen(const FString& MapName);
	UFUNCTION()
		virtual void EndLoadingScreen();
	
	
};



As you can see i’ve added include.

So if you want to use your custom movie then uncomment the line with


//LoadingScreen.MoviePaths.Add(TEXT("quest5")); /*This is the movie name*/

But how to add movie to project?

Create Folder in **CONTENT **and name it Movies. Put there your .mp4 file

And that’s all :slight_smile:
Just regenerate project files and make function to switch to another world and wuala :smiley:

Have a nice day :slight_smile:

**[FONT=Comic Sans MS]
REMEMBER ABOUT PLAYING AS STANDALONE GAME.

Thanks for the tutorial! It took me a while to get videos to play a few months ago. Here’s the video encoding settings that I got to work without issues. If I remember right, I think I had issues with videos at higher resolutions. But that was under UE4.12 and I haven’t tested higher resolutions in 4.13 or 4.14 yet.

VideoSettings.jpg

@Parvan
Was trying with 1280x720

I’m not sure about max resolution for videos but HD seems to be working.
Just let it try :wink:

Cheers
@Parvan
I’m not sure but i think it’s working only with 1:1 size or video is smaller and screen is bigger.

I did all this (mp4 file in content/movies as well) but when it loads it just shows the default animated umg loading icon in the center of the screen. Any clue what this might be? I’m running on 4.14 right now. Is there at least a way to move the location of the loading icon?