Player resolution

Games put player components in different places: on the player controller, the player state or the pawn. Plugins must find them anyway. Pulse::Player (C++) and UPulsePlayerLibrary (Blueprint) resolve the parts of a player from any of its actors.

Function Returns
GetController(Actor) The controller of a controller, pawn, player state or of an actor owned by one of them (up to 8 owners deep)
GetPlayerController(Actor) Same, as player controller
GetPlayerState(Actor) The player state; works on clients for pawns of other players
GetPawn(Actor) The pawn
GetPlayerId(Actor) A stable id of the player: the unique net id of its player state, else the player name; the same in every session (save identifiers of player actors)
FindPlayerStateById(World, Id) The way back: the player state with that id among the player states of the game state (Blueprint Find Pulse Player State By Id). Works on every machine, because the player states of all players replicate to everyone; null for an empty id, before the game state exists and for players who left (inactive player states)
IsPlayerActor(Actor) Whether the actor is the controller, player state or pawn of a player itself (not an actor owned by one)
GetLocalPlayer(Actor) The local player of a locally controlled player
GetPlayerActors(Actor, Out) The actor, its controller, player state and pawn, without duplicates
FindComponentOnPlayer<T>(Actor) The first component of type T on the actor, controller, player state or pawn
FindInterfaceOnPlayer(Actor, Interface) The first actor, then component, implementing an interface
// A quest manager can sit on the controller or the player state
UMyQuestManager* manager = Pulse::Player::FindComponentOnPlayer<UMyQuestManager>(InstigatorPawn);

On a client, controllers of other players do not exist: GetController returns null for their pawns and player states, while GetPlayerState still works through the pawn.

The ids compare case-sensitive. Without a unique net id the id is the player name, which can repeat offline or in split screen: FindPlayerStateById then returns the first player state with that name.


PulseFoundation plugin documentation.

This site uses Just the Docs, a documentation theme for Jekyll.