Announcement

Collapse
No announcement yet.

Movie - Loading screen little fix [~4.14]

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [TUTORIAL] 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
    Big thanks to [MENTION=155]TheJamsh[/MENTION] 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

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

    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

    Code:
    [/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


    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:

    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
    Code:
    #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
    Code:
    //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
    Just regenerate project files and make function to switch to another world and wuala

    Have a nice day


    REMEMBER ABOUT PLAYING AS STANDALONE GAME.
    Last edited by MrFajaPL; 12-03-2016, 07:02 PM.

    #2
    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.

    Click image for larger version

Name:	VideoSettings.jpg
Views:	1
Size:	56.6 KB
ID:	1119486

    Metahusk: A 501(c)(3) Creative Development Cooperative
    Projects | Forums | Repositories | Nonprofit | Donate

    Comment


      #3
      [MENTION=15170]Parvan[/MENTION]
      Was trying with 1280x720

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

      Cheers
      [MENTION=15170]Parvan[/MENTION]
      I'm not sure but i think it's working only with 1:1 size or video is smaller and screen is bigger.
      Last edited by MrFajaPL; 12-04-2016, 06:18 AM.

      Comment


        #4
        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?

        Comment

        Working...
        X