I’ve been having this weird problem while trying to work on a small project to get my feet wet with networking. Unfortunately I seem to be running into what I suspect to be a simple problem, but I’m not experienced enough to make heads or tails of it.
Right now I have a player controller class ASurvivalRPGPlayerController that has the following action input on left mouse button:
void ASurvivalRPGPlayerController::ActionEventMouse1()
{
if (Role == ROLE_Authority)
{
if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "MOUSE 1 PRESSED");
}
if (PlayerRef) PlayerRef->ServerTriggerInteract();
}
The problem is that MOUSE 1 PRESSED appears on the screen twice, regardless of the number of clients (I’m using a dedicated server.). This propagates down to any additional functionality that I call as a result of the click (as in my object interact functionality alluded to by the last line).
The weird part is that, when I switch the Role check to ROLE_Authority instead of ROLE_AutonomousProxy, no messages show up at all. This is behavior I would only expect if there is no authoritative version of a player’s SurvivalRPGPlayerController actor.
What gives? Can anyone explain why this is happening and what I can do about it?
EDIT: For Content