Hi,
I’m having a hard time to understand why my function that i call during my CustomGameMode PostLogin function does not get triggered on the client.
Basically I created a GameMode and overwrote the PostLogin function.
Now I want to call a function on the connected playercontroller:
void ADefaultGameMode::PostLogin(APlayerController * NewPlayer)
{
Super::PostLogin(NewPlayer);
APlayerControllerBase* ControllerBase = Cast<APlayerControllerBase>(NewPlayer);
if(ControllerBase == nullptr) return;
ControllerBase->Client_AssignTask();
}
My PlayerController class looks like this:
UCLASS()
class TR8R_API APlayerControllerBase : public APlayerController
{
GENERATED_BODY()
public:
APlayerControllerBase();
virtual void PlayerTick(float DeltaTime) override;
UFUNCTION(Client, Reliable)
void Client_AssignTask();
};
#include "PlayerControllerBase.h"
APlayerControllerBase::APlayerControllerBase()
{
PrimaryActorTick.bCanEverTick = true;
bReplicates = true;
}
void APlayerControllerBase::PlayerTick(float DeltaTime)
{
Super::PlayerTick(DeltaTime);
}
void APlayerControllerBase::Client_AssignTask_Implementation()
{
UE_LOG(LogTemp, Warning, TEXT("HEY. I GOT A NEW TASK"));
}
When I start the Game as a Listen Server the function gets called on the Server Playercontroller, but not on the newly connected Client PlayerController.
I already tried a bunch of different options but nothing seems to work.
Is there a default way to do it or am I missing something?
Thanks in advance!