Download

[Solved] PlayerController is Never Calling 'Tick / BeginPlay' on Client

Hey guys. I’m having an interesting time with this problem. My PlayerController class’ BeginPlay and Tick are being called on being called server-side, as expected. However, when adding debug for when !HasAuthority, that’s never printed, meaning that neither Tick or BeginPlay are firing clientside for this controller. Any ideas would be greatly appreciated! Thanks!

void MyPlayerController::BeginPlay()
{
	Super::BeginPlay();
	
	bShowMouseCursor = true;
	DefaultMouseCursor = EMouseCursor::Crosshairs;
	bEnableClickEvents = true;
	bEnableMouseOverEvents = true;

	if(!HasAuthority())
	{
		GEngine->AddOnScreenDebugMessage(-1, 10, FColor::Green, TEXT("Client Begin Play"));
	}
}

void MyPlayerController::Tick(float DeltaSeconds)
{
	Super::Tick(DeltaSeconds);

	UE_LOG(LogTemp, Error, TEXT("Server Tick"));
	
	if(!HasAuthority())
	{
		UE_LOG(LogTemp, Error, TEXT("Client Tick"));
	}
}

For anyone in the future, if you have this problem, check that you are testing in “Play as Client” in the editor and not just as “listen server”. These were working the whole time, they just weren’t printing to log because it was acting as a server (or so, that’s how I’ve come to understand it).