Hello dear Unreal community,
I’ve been looking for a solution to fade the screen in and out between levels for a while now. I’m currently using the following method in the PlayerController in BeginPlay() to fade in the screen:
PlayerCameraManager->StartCameraFade(1.f, 0.f, 1.f, FLinearColor::Black, false, false);
The PlayerController has a method NewLevel(), there the screen is faded out (which also only flashes briefly) and over a short timer the actual loading of the new level is triggered.
void ATest_Player_Controller::NewLevel()
{
PlayerCameraManager->StartCameraFade(1.f, 0.f, 1.f, FLinearColor::Black, true, true);
FTimerHandle UnusedHandle;
GetWorldTimerManager().SetTimer(UnusedHandle, this, &ATest_Player_Controller::LoadNewLevel, .8f, false);
}
The timer function looks like this:
void ATest_Player_Controller::LoadNewLevel()
{
UGameplayStatics::OpenLevel(GetWorld(), TEXT("/Game/Maps/Gameplay_01"), TRAVEL_Absolute);
}
Unfortunately the screen only flashes for a very short time, there is not really anything to see of a crossfade. I’ve seen various examples with blueprints, but really haven’t found anything for C++. Also I didn’t find a way to control the time that the crossfade takes.
About the post processing you can probably still control the “gain” parameter, but I have not found how to do that either. So I only found examples for blueprints - which I would also use if I knew how to use them with C++.
Maybe someone has a tip? Thanks in advance for any help.