I have a blueprint character based on a C++ character class
when I play in PIE the blueprint character spawns but the PossessedBy Function never gets called in C++ however the blueprint possessed event does gets called
In .h
virtual void PossessedBy(AController * NewController) override;
**In .cpp **
void ALFCharacter::PossessedBy(AController * NewController)
{
UE_LOG(LogTemp, Warning, TEXT("Posssessed"));
GEngine->AddOnScreenDebugMessage(-1, 4, FColor::Red, "Posssessed");
if(IsPlayerControlled())
SetViewToCamera();
Super::PossessedBy(NewController);
}
The log strings “Posssessed” is never printed nor are the functions in it ever called
Another thing is the function SetViewToCamera is set to be called in begin play as well but its never called.
.h
UFUNCTION(BlueprintCallable,Client,Reliable,Category="Camera")
void SetViewToCamera();
.cpp
void ALFCharacter::BeginPlay()
{
GEngine->AddOnScreenDebugMessage(-1, 4, FColor::Red, "call ");
SetViewToCamera();
GEngine->AddOnScreenDebugMessage(-1, 4, FColor::Red, "after call ");
}
void ALFCharacter::SetViewToCamera_Implementation()
{
GEngine->AddOnScreenDebugMessage(-1, 4, FColor::Red, "setview to ");
APlayerController* APC = Cast<APlayerController>(this->GetController());
if (APC == nullptr)
{
GEngine->AddOnScreenDebugMessage(-1, 4, FColor::Red, "Null Player Controller");
return;
}
else
GEngine->AddOnScreenDebugMessage(-1, 4, FColor::Green, "Good Player Controller");
APC->SetViewTargetWithBlend(PlayerCamera);
}
However none of the SetViewToCamera_Implementation logs are printed .
I know I’m calling it correctly because the logs call and after call print alright in begin play but the _Implementation is never called
I tried both dedicated server and standalone on UE4.12.5 to no avail
This is very weird bug , how do I fix this?