Issue with GetPlayerController(1) in Multiplayer Setup

I’m encountering an issue with my multiplayer game setup in Unreal Engine. Specifically, I’m having trouble using GetPlayerController(1) to access the second player controller. The function GetPlayerController(0) works perfectly for the first player, but when I try to use GetPlayerController(1), it returns None, causing a runtime error.

Error Message:

PIE: Error: Blueprint Runtime Error: "Accessed None trying to read property CallFunc_GetPlayerController_ReturnValue_1". Node: Set View Target with Blend Graph: EventGraph Function: Execute Ubergraph BP Third Person Game Mode Blueprint: BP_ThirdPersonGameMode

Steps Taken:

  1. Used Create Local Player node to add a second player.
  2. Attempted to use GetPlayerController(1) to access the second player controller.
  3. Tried using C++ for the game mode, but the same issue persists.
  4. Ran the game as a listen server, but player 2 is still missing.

Despite these steps, the second player controller is not being recognized. This issue is affecting my entire multiplayer code, as many functions rely on accessing the second player controller.

Any insights or solutions to resolve this issue would be greatly appreciated!

Do not use Get Player Controller (index) in multiplayer.

From Pawn use Get Controller, then Cast to the controller class.

Clients only have a reference to Their Controller. Client controllers are NOT replicated to other players.

If you need to reference another players controller it has to be done on the server by the other players Pawn.

Server → Get a reference to the other players Pawn.
Pawn -> Get Controller -> cast

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.