ue4plugins / LoadingScreen

A plugin for Unreal Engine 4 to expose simple controls for managing load screens.
MIT License
504 stars 163 forks source link

Option to have the Loading Screen behind the video? #14

Open Abatron opened 7 years ago

Abatron commented 7 years ago

Hi, Thanks for the plugin. I was wondering how to make the slate loading screen appear behind the video. I have a quick video but after its done, i'd like to have the loading screen still up. Currently, the loading screen is in front of the video.

I'm not sure if there is a slate z-order command or should I find an end of movie event, tie a delegate to that to draw the loadingscreen after it has ended.

Abatron commented 7 years ago

Ok, I was able to get the delegate approach to work.

For those interested:
1) Add Delegate in StartupModule GetMoviePlayer()->OnMoviePlaybackFinished().AddRaw(this, &FLoadingScreenModule::HandleMoviePlaybackFinished);

2) Modify "void FDefaultGameMoviePlayer::TickStreamer(float DeltaTime)" after MovieStreamingIsDone.Set(1); Add the line: "BroadcastMoviePlaybackFinished();" to call the Movie Player Delegate

3) In your Callback Function void FLoadingScreenModule::HandleMoviePlaybackFinished() { GetMoviePlayer()->SetSlateOverlayWidget(WidgetLoadingScreen); }

4) Remove Delegate in ShutdownModule()

Make sure to create your WidgetLoadingScreen during the Startup Module, as you will get an error afterwards cause its not in the game thread. It works in the startup module because the gamethread is not initialized yet and returns true.

Hope that helps, helped me out. If a better example is needed, i'd be glad to share it.