PlayerControllers exist only on server and client that PlayerController belongs to (if there 2 local players there wll be 2 PCs, so all local players), other players clients can’t access PlayerControllers of other players, they simply don’t exist on them. If you want to share some data to other players you place it in PlayerState which is replicated to all clients.
Just hands up, same goes with GameMode, but it only exist on server and same as with PC there GameState class to shere data with clients
In Addition to what provided, you should distinguish with the isLocallyControlled node and Check If you are running on Server or client. Also, I would suggest to move that Logic Out of the Tick. Casting is relative expensive. Where do you Spawn your pawn? Maybe a good way would be to add a playerController variable to the pawn which is the Type of your PC and Set that when spawning the pawn (Check exposed of the variable). Then in your Tick use a validated get. Your playerController exists the complete Experience and doesn’t Change, your pawn does, keep that in mind when changing Levels or Connect to a Server eg.
I don’t know, but more expensive than just reading a pointer/ref of a variable I heared several Epic staff talking to avoid it in tick. I mean, its running depending on your framerate like 120 times a second. even small numers you could save, I would try to save them, at least when it is nearly no affort to avoid them.
Thanks for the response but I’m still a little confused. Isn’t my pawn casting to their player controller so it doesn’t matter that it isn’t replicated to any of the other clients. Essentially only the server and the owning client need to know about this variable so I would think using player controllers would work.
All pawns will be in client and all isnatces of it will be executed on client, so only local once iwll be possessed by PlayerController in single client. Client can not do any RPC to foreign PlayerController
Set a Breakpoint at the cast and Test with more then one Client. Ue will Stop in the Breakpoint and in Debugger you will See which instance you’ve braked. Then you can Change in the world outliner to this world (Like client1) and See all actors this specific Client has