Navigation
API > API/Runtime > API/Runtime/Engine > API/Runtime/Engine/UGameplayStatics
Description
Returns the player controller found while iterating through the local and available remote player controllers. On a network client, this will only include local players as remote player controllers are not available. The index will be consistent as long as no new players join or leave, but it will not be the same across different clients and servers.
| Name | GetPlayerController |
| Type | function |
| Header File | /Engine/Source/Runtime/Engine/Classes/Kismet/GameplayStatics.h |
| Include Path | #include "Kismet/GameplayStatics.h" |
| Source | /Engine/Source/Runtime/Engine/Private/GameplayStatics.cpp |
UFUNCTION (BlueprintPure, Category="Game",
Meta=(WorldContext="WorldContextObject", UnsafeDuringActorConstruction="true"))
static APlayerController * GetPlayerController
(
const UObject * WorldContextObject,
int32 PlayerIndex
)
Parameters
| Name | Remarks |
|---|---|
| PlayerIndex | Index in the player controller list, starting first with local players and then available remote ones |