This is incredibly stupid but at the same time, I can’t figure it out. I know player controllers only exist on the client, but I don’t understand why I can’t get the controller on the clients themselves either. I have the following code in the BeingPlay() of my Character class :
myController = Cast<AFPSGameController>(GetController());
if (myController) {
FString msg = “Controller fetched in " + GetName();
UKismetSystemLibrary::PrintString(this, (TEXT(”%s"), *msg));
}
I would expect this code to print 1 line each on the instances. What I mean is if I start 4 instances of the game (1 server, 3 clients), I thought each client would be able to successfully get their own player controllers. So suppose Char_1, Char_2, Char_3, and Char_4 get spawned for server, client 1, client 2, and client 3 respsectively, Char_1 would successfully fetch and print the message on server, Char_2 would print the message on client 1, Char_3 on client 2, Char_4 on client 3.
But the logs being printed look like this :
LogBlueprintUserMessages: [EBaseCharacter_C_1] Server: Controller fetched in EBaseCharacter_C_1
LogBlueprintUserMessages: [EBaseCharacter_C_0] Client 3: Controller fetched in EBaseCharacter_C_0
LogBlueprintUserMessages: [EBaseCharacter_C_0] Client 1: Controller fetched in EBaseCharacter_C_0
LogBlueprintUserMessages: [EBaseCharacter_C_0] Client 2: Controller fetched in EBaseCharacter_C_0
Really sorry for being a noob but I’m having a tough time with this. Any help would be appreciated.