UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FLocalPlayerContext Struct Reference

#include <LocalPlayer.h>

Public Member Functions

ENGINE_API FLocalPlayerContext ()
 
ENGINE_API FLocalPlayerContext (const class ULocalPlayer *InLocalPlayer, UWorld *InWorld=nullptr)
 
ENGINE_API FLocalPlayerContext (const class APlayerController *InPlayerController)
 
ENGINE_API bool IsValid () const
 
ENGINE_API bool IsInitialized () const
 
ENGINE_API bool IsFromLocalPlayer (const AActor *ActorToTest) const
 
ENGINE_API UWorldGetWorld () const
 
ENGINE_API UGameInstanceGetGameInstance () const
 
ENGINE_API class ULocalPlayerGetLocalPlayer () const
 
ENGINE_API class APlayerControllerGetPlayerController () const
 
template<class T >
T * GetPlayerController (bool bCastChecked=false) const
 
ENGINE_API class AGameStateBaseGetGameState () const
 
template<class T >
T * GetGameState (bool bCastChecked=false) const
 
ENGINE_API class APlayerStateGetPlayerState () const
 
template<class T >
T * GetPlayerState (bool bCastChecked=false) const
 
ENGINE_API class AHUD * GetHUD () const
 
template<class T >
T * GetHUD (bool bCastChecked=false) const
 
ENGINE_API class APawn * GetPawn () const
 
template<class T >
T * GetPawn (bool bCastChecked=false) const
 

Detailed Description

A context object that binds to a LocalPlayer. Useful for UI or other things that need to pass around player references

Constructor & Destructor Documentation

◆ FLocalPlayerContext() [1/3]

FLocalPlayerContext::FLocalPlayerContext ( )

◆ FLocalPlayerContext() [2/3]

FLocalPlayerContext::FLocalPlayerContext ( const class ULocalPlayer InLocalPlayer,
UWorld InWorld = nullptr 
)

◆ FLocalPlayerContext() [3/3]

FLocalPlayerContext::FLocalPlayerContext ( const class APlayerController InPlayerController)

Member Function Documentation

◆ GetGameInstance()

UGameInstance * FLocalPlayerContext::GetGameInstance ( ) const

Returns the game instance

◆ GetGameState() [1/2]

class AGameStateBase * FLocalPlayerContext::GetGameState ( ) const

Getter for the Game State Base

◆ GetGameState() [2/2]

template<class T >
T * FLocalPlayerContext::GetGameState ( bool  bCastChecked = false) const
inline

Templated Getter for the Game State

◆ GetHUD() [1/2]

AHUD * FLocalPlayerContext::GetHUD ( ) const

Getter for this player's HUD

◆ GetHUD() [2/2]

template<class T >
T * FLocalPlayerContext::GetHUD ( bool  bCastChecked = false) const
inline

Templated Getter for the HUD

◆ GetLocalPlayer()

ULocalPlayer * FLocalPlayerContext::GetLocalPlayer ( ) const

Returns the local player.

◆ GetPawn() [1/2]

class APawn * FLocalPlayerContext::GetPawn ( ) const

Getter for the base pawn of this player

◆ GetPawn() [2/2]

template<class T >
T * FLocalPlayerContext::GetPawn ( bool  bCastChecked = false) const
inline

Templated getter for the player's pawn

◆ GetPlayerController() [1/2]

APlayerController * FLocalPlayerContext::GetPlayerController ( ) const

Returns the player controller.

◆ GetPlayerController() [2/2]

template<class T >
T * FLocalPlayerContext::GetPlayerController ( bool  bCastChecked = false) const
inline

Templated version of GetPlayerController()

◆ GetPlayerState() [1/2]

APlayerState * FLocalPlayerContext::GetPlayerState ( ) const

Getter for the Player State

◆ GetPlayerState() [2/2]

template<class T >
T * FLocalPlayerContext::GetPlayerState ( bool  bCastChecked = false) const
inline

Templated Getter for the Player State

◆ GetWorld()

UWorld * FLocalPlayerContext::GetWorld ( ) const

Returns the world context.

◆ IsFromLocalPlayer()

bool FLocalPlayerContext::IsFromLocalPlayer ( const AActor ActorToTest) const

This function tests if the given Actor is connected to the Local Player in any way. It tests against the APlayerController, APlayerState, and APawn.

◆ IsInitialized()

bool FLocalPlayerContext::IsInitialized ( ) const

Is this context initialized

◆ IsValid()

bool FLocalPlayerContext::IsValid ( ) const

Is this context initialized and still valid?


The documentation for this struct was generated from the following files: