truong-bui / AsyncLoadingScreen

Async Loading Screen is a free and open-source plugin for Unreal Engine. Async Loading Screen allows you to easily configure a Loading Screen System in the project settings, and automatically add a Loading Screen whenever you open a new level, without Level Streaming.
https://www.unrealengine.com/marketplace/en-US/product/async-loading-screen
MIT License
787 stars 99 forks source link

Show Startup Loading Screen after all movies being played #6

Closed plus1pixel closed 3 years ago

plus1pixel commented 3 years ago

I guess its a feature request as i cant seem to find that kind of option. What i want is to play couple short movies on startup (UE logo, studio logo) followed with slate loading widget. I have tried to do it on my own but it throws me and error that i must operate with slate only in slate thread.... assertion failed and yada yada :(

plus1pixel commented 3 years ago

Ok ive figured it out myself (-;

For those who wonder how to do it - i cheated :p There are 2 helper functions to switch visibilty of widget in MoviePlayer.cpp, so i just slightly modified them and added to slate widget template files of this plugin.

EVisibility SClassicLayout::GetWidgetVisibility() const { return (!GetMoviePlayer()->IsMovieCurrentlyPlaying() && !GetMoviePlayer()->IsLoadingFinished()) ? EVisibility::Visible : EVisibility::Collapsed; } and then call it somewhere (just like they do in MoviePlayer.cpp for SLoadingScreenTestWidget) to hide widget or its part or w/e .Visibility(this, &SClassicLayout::GetWidgetVisibility) So basicly widget is allways there but stays hidden till movies being played. This can be improved further as there are alot of functions avaliable for MoviePlayer (check MoviePlayer.h it's well commented) aswell as logic could be ran using plugin options variables.

Technically, proper way to do it is to make delegate for GetMoviePlayer()->OnMoviePlaybackFinished() GetMoviePlayer()->OnMoviePlaybackFinished().AddRaw(this, &FLoadingScreenModule::HandleMoviePlaybackFinished); and then try to push widgets shared pointer that was created on a startup in it like this GetMoviePlayer()->SetSlateOverlayWidget(SplashScreenWidget); You can find how to do it in another fork of LoadingScreen plugin by OldSiren... but that results crash ive mentioned in first post on 4.25.