Skip to content

Unreal Engine plugin to make it easy to implement screen fade in Blueprints and C++.

License

Notifications You must be signed in to change notification settings

suramaru517/ScreenFade

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ScreenFade

Blueprint

ScreenFade

C++

static void Fade(
	const UObject* WorldContextObject,
	const FScreenFadeParams& FadeParams,
	const APlayerController* OwningPlayer = nullptr,
	const int32 ZOrder = 100
);

static void FadeIn(
	const UObject* WorldContextObject,
	const float Time = 1.0f,
	const FLinearColor& FromColor = FLinearColor::Black,
	const FScreenFadeDelegate& OnFinished = FScreenFadeDelegate(),
	const bool bFadeAudio = true,
	const bool bFadeWhenPaused = true,
	const APlayerController* OwningPlayer = nullptr,
	const int32 ZOrder = 100
);

static void FadeOut(
	const UObject* WorldContextObject,
	const float Time = 1.0f,
	const FLinearColor& ToColor = FLinearColor::Black,
	const FScreenFadeDelegate& OnFinished = FScreenFadeDelegate(),
	const bool bFadeAudio = true,
	const bool bFadeWhenPaused = true,
	const APlayerController* OwningPlayer = nullptr,
	const int32 ZOrder = 100
);

static void ClearFade(
	const UObject* WorldContextObject,
	const APlayerController* OwningPlayer = nullptr
);

static bool IsFading(
	const UObject* WorldContextObject,
	const APlayerController* OwningPlayer = nullptr
);

Example:

MyProject.Build.cs

PublicDependencyModuleNames.Add("ScreenFade");

MyActor.cpp

#include "MyActor.h"
#include "ScreenFadeFunctionLibrary.h"

void AMyActor::BeginPlay()
{
	Super::BeginPlay();

	UScreenFadeFunctionLibrary::FadeIn(this, 1.0f, FLinearColor::Black, FScreenFadeDelegate::CreateUObject(this, &AMyActor::OnFadeInFinished));
}

void AMyActor::OnFadeInFinished()
{
	UScreenFadeFunctionLibrary::FadeOut(this, 1.0f, FLinearColor::Black, FScreenFadeDelegate::CreateWeakLambda(this, []()
	{
		UE_LOG(LogTemp, Log, TEXT("Finished"));
	}));
}

About

Unreal Engine plugin to make it easy to implement screen fade in Blueprints and C++.

Resources

License

Stars

Watchers

Forks