Download

How to use APlayerCameraMananger correctly

Hey Guys,

I have been stuck with this problem for over 8 hours now and I just think there is something I’m not seeing or don’t know about yet.
To be fair I am new to the Unreal Engine and I have been prototyping with it mainly in C++.

I created a project based on the FirstPersonTemplate.
Want I want to achieve right now is when the game starts the camera should fade from black to the game.

I searched on the API and came across this function:


APlayerCameraManager::StartCameraFade(float FromAlpha,float ToAlpha,float Duration,FLinearColor Color,bool bShouldFadeAudio,bool bHoldWhenFinished)

But I have no idea how to call this function and from where.

I created a C++ Component on the FirstPersonTemplate player.

I tried to get the the class with


FindComponentByClass<Comp>()

but it doesn’t inherit from UActorComponent so its invalid.
I also tried to cast it from the script via


cameraManager = Cast<APlayerCameraManager>(GetClass());

But this also gave me a null refrence.

Maybe one of you could guide me on the right path or give me an example?

Greetings,

Kyle

The Player Camera Manager instance is referenced by the Player Controller, so you can get it from there.



APlayerController::PlayerCameraManager


Also, there’s a community tutorial for a fade effect here: https://wiki.unrealengine.com/Global_Fade_In_out - though I do mine differently.

Thank you for your reply!
It worked greatly with:



UGameplayStatics::GetPlayerController(GetWorld(), 0)->PlayerCameraManager->StartCameraFade(1.f, 0.f, 2.f, FLinearColor(0.f, 0.f, 0.f, 1.f), false, false);