LocalPlayer vs LocalController

For any given APlayerController,



when IsLocalController() is true,

GetLocalPlayer() would always be NOT NULL ?



And, vice versa,

when IsLocalController() is false,

GetLocalPlayer() would always be NULL ?


1 Like

Assuming everything is functioning as intended, yes. But technically, the logic isn’t completely tied together so there could be edge cases where the rule is broken. GetLocalPlayer() returns a cast of Player to ULocalPlayer, so if the Player isn’t of a local player class then it will return NULL. IsLocalController().doesn’t use that method to indicate if it’s a local controller, but the overall logic should work so the two functions are consistent.

1 Like