UGameplayStatics::GetPlayerState

Returns the player state at the given index in the game state's PlayerArray.

Choose your operating system:

Windows

macOS

Linux

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Kismet/GameplayStatics.h

Include

#include "Kismet/GameplayStatics.h"

Source

/Engine/Source/Runtime/Engine/Private/GameplayStatics.cpp

Syntax

static APlayerState * GetPlayerState
(
    const UObject * WorldContextObject,
    int32 PlayerStateIndex
)

Remarks

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.

Parameters

Parameter

Description

PlayerStateIndex

Index into the game state's PlayerArray