Each controller on the server is linked to a corresponding client controller (they have the same NetID), except for the listening server controller (he doesn’t need it).
So yes, a single controller on a server is the same as a controller on a specific client.
If it is “not that” controller, then the reference on the client will be invalid, since clients do not have access to other players’ controllers.
If the reference is valid on the client, then “IsLocalController” for that controller should also return “true”.
Is that the case for you?
For instance, this code running whenever the player click on the client always trigger Weapon has no valid PlayerController owner!:
APlayerController* OwnerPC = Cast<APlayerController>(GetOwner());
if (OwnerPC) {
// Check if the owner is the local controller
if (OwnerPC->IsLocalController()) {
UE_LOG(LogTemp, Log, TEXT("This weapon's owner is the local controller: %s"), *OwnerPC->GetName());
}
else {
UE_LOG(LogTemp, Log, TEXT("This weapon's owner is NOT the local controller: %s"), *OwnerPC->GetName());
}
}
else {
UE_LOG(LogTemp, Warning, TEXT("Weapon has no valid PlayerController owner!"));
}
The Owner is correctly changed on the Server but not the Client, which is really weird to me… It’s like if the replication doesn’t actually work (OnRep_Owner() doesn’t trigger either, which explains why the client Owner doesn’t change… which is a problem)
Can you make an RPC event that any client can call and try to call it from each client?
As I said earlier - clients do not have access to other player controllers and therefore the reference will not be valid, the GetOwner function on the client will return null if the owner is another client.
I made the dumb mistake to forget to call Super::GetLifetimeReplicatedProps(OutLifetimeProps); , it’s so dumb but that will NEVER happen again lol… Took me 3 days!