Download

How to display a custom loading screen at any time

I’ve been looking at MoviePlayer.

I can’t seem to get anything to show up. I actually need the loading screen after map load because I have a long random level generating step happening in BeginPlay. As far as I understand from all the samples I’ve seen, I just call SetupLoadingScreen and it should start playing somehow. I even tried calling PlayMovie with no effect. I don’t actually have a movie, just a Slate Widget.

I’m hoping to be able to update the text in the widget eventually with progress saying what steps are complete.

Here’s some of my code so far:



class SLGLoadingScreenWidget : public SCompoundWidget
{
public:
	SLATE_BEGIN_ARGS(SLGLoadingScreenWidget) {}
	SLATE_END_ARGS()

		void Construct(const FArguments& InArgs)
	{
		ChildSlot
			
				SNew(SOverlay)
				+ SOverlay::Slot()
				.HAlign(HAlign_Fill)
				.VAlign(VAlign_Fill)
				
					SNew(STextBlock)
					.Text(NSLOCTEXT("WRAITH", "LOAD_SCREEN_Loading", "Loading"))
				]
			];
	}
};

void UWRGameplayStatics::StartLoadingScreen()
{
	FLoadingScreenAttributes LoadingScreen;
	LoadingScreen.bAutoCompleteWhenLoadingCompletes = false;
	LoadingScreen.WidgetLoadingScreen = SNew(SLGLoadingScreenWidget);

	GetMoviePlayer()->SetupLoadingScreen(LoadingScreen);
	GetMoviePlayer()->PlayMovie();
}