Navigation
API > API/Runtime > API/Runtime/Engine > API/Runtime/Engine/UGameplayStatics
Description
Returns the player state at the given index in the game state's PlayerArray. This will work on both the client and server and the index will be consistent. After initial replication, all clients and the server will have access to PlayerStates for all connected players.
| Name | GetPlayerState |
| 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 APlayerState * GetPlayerState
(
const UObject * WorldContextObject,
int32 PlayerStateIndex
)
Parameters
| Name | Remarks |
|---|---|
| PlayerStateIndex | Index into the game state's PlayerArray |