InputComponent->BindAxis does not work for the client side, why?

Hi! This works for the server, but not for “Play as client”. I can’t understand why. Thanks for any hint.

While the same logic in the blueprint is processed correctly

APawnCameraController::APawnCameraController()
{
	//bShowMouseCursor = true;
	//PrimaryActorTick.bCanEverTick =false;
	//PrimaryActorTick.bStartWithTickEnabled =false;

	MoveForwardName = "MoveForward";
	MoveRightName = "MoveRight";
	RotateYawName = "RotateYaw";
}

void APawnCameraController::BeginPlay()
{
	Super::BeginPlay();
	
}

void APawnCameraController::SetupInputComponent()
{
	Super::SetupInputComponent();
	check(InputComponent);

		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::Printf(TEXT("TEST: SetupInputComponent")));
	
	InputComponent->BindAxis(MoveForwardName, this, &APawnCameraController::MoveForward);
	InputComponent->BindAxis(MoveRightName, this, &APawnCameraController::MoveRight);
	InputComponent->BindAxis(RotateYawName, this, &APawnCameraController::RotateYaw);
}

void APawnCameraController::OnPossess(APawn* InPawn)
{
	Super::OnPossess(InPawn);

	PawnCamera = Cast<APawnCamera>(InPawn);
}

void APawnCameraController::MoveForward(float Value)
{
	if(Value && PawnCamera)
	{
		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::Printf(TEXT("TEST: move forvard")));
		PawnCamera->MoveForward(Value);
	}
	
}

void APawnCameraController::MoveRight(float Value)
{
	if(Value && PawnCamera)
	{
		PawnCamera->MoveRight(Value);
	}
	
}

void APawnCameraController::RotateYaw(float Value)
{
	if(Value && PawnCamera)
	{
		PawnCamera->RotateYaw(Value);
	}
}
1 Like

Hi, I have the same problem, could u fix it? the most interesting thing is that when playing in the editor, everything works as it should, but as soon as individual clients are launched, the input component stops working for the client

1 Like