UGameplayStatics::GetPlayerController

Returns the player controller found while iterating through the local and available remote player controllers.

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 APlayerController * GetPlayerController
(
    const UObject * WorldContextObject,
    int32 PlayerIndex
)

Remarks

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.

Parameters

Parameter

Description

PlayerIndex

Index in the player controller list, starting first with local players and then available remote ones