Nelaric Unreal Gameplay
Gameplay framework API
Loading...
Searching...
No Matches
UNelaricPawnComponent Class Reference

Base for gameplay components owned directly by a pawn. More...

#include <NelaricPawnComponent.h>

Inheritance diagram for UNelaricPawnComponent:
UGameplayComponent UPawnInitStateComponent

Public Member Functions

GAMEPLAYRUNTIME_API APawn * GetPawn () const
 Gets the pawn that directly owns this component.
template<typename T>
T * GetPawn () const
 Gets the owning pawn as a specific pawn type.
GAMEPLAYRUNTIME_API AController * GetController () const
 Gets the pawn's current controller on this machine.
template<typename T>
T * GetController () const
 Gets the current controller as a specific controller type.
GAMEPLAYRUNTIME_API APlayerController * GetPlayerController () const
 Gets the current controller when it is a player controller.
template<typename T>
T * GetPlayerController () const
 Gets the player controller as a specific player controller.
GAMEPLAYRUNTIME_API APlayerState * GetPlayerState () const
 Gets player state directly from the owning pawn.
template<typename T>
T * GetPlayerState () const
 Gets the pawn's player state as a specific player state type.
GAMEPLAYRUNTIME_API bool IsLocallyControlled () const
 Queries the pawn's native local-control semantics.
GAMEPLAYRUNTIME_API bool IsPlayerControlled () const
 Queries the pawn's native player-control semantics.

Detailed Description

Base for gameplay components owned directly by a pawn.

The pawn owns the component and determines its lifetime. Queries read current local state without caching or replication. Call only on the game thread. Returned pointers are non-owning and do not keep objects alive; revalidate references retained across frames. Controller and player state availability is not guaranteed at BeginPlay. Tick and component replication are disabled by default.

Member Function Documentation

◆ GetController() [1/2]

template<typename T>
T * UNelaricPawnComponent::GetController ( ) const
inline

Gets the current controller as a specific controller type.

Call on the game thread. Follows GetController() lifetime.

Template Parameters
TComplete controller type derived from AController.
Returns
Non-owning controller, or null if unavailable or mismatched.

◆ GetController() [2/2]

GAMEPLAYRUNTIME_API AController * UNelaricPawnComponent::GetController ( ) const

Gets the pawn's current controller on this machine.

Call on the game thread. Unpossessed pawns and remote client pawns may have no controller. The result is never cached.

Returns
Non-owning controller, or null if unavailable or destroying.

◆ GetPawn() [1/2]

template<typename T>
T * UNelaricPawnComponent::GetPawn ( ) const
inline

Gets the owning pawn as a specific pawn type.

Call on the game thread. Uses the same lifetime as GetPawn().

Template Parameters
TComplete pawn type derived from APawn.
Returns
Non-owning pawn, or null if unavailable or of another type.

◆ GetPawn() [2/2]

GAMEPLAYRUNTIME_API APawn * UNelaricPawnComponent::GetPawn ( ) const

Gets the pawn that directly owns this component.

Call on the game thread. Does not traverse actor ownership.

Returns
Non-owning pawn, or null for a missing, invalid, destroying, or non-pawn owner.

◆ GetPlayerController() [1/2]

template<typename T>
T * UNelaricPawnComponent::GetPlayerController ( ) const
inline

Gets the player controller as a specific player controller.

Call on the game thread. Follows GetController() lifetime.

Template Parameters
TComplete player controller type derived from APlayerController.
Returns
Non-owning player controller, or null if unavailable or mismatched.

◆ GetPlayerController() [2/2]

GAMEPLAYRUNTIME_API APlayerController * UNelaricPawnComponent::GetPlayerController ( ) const

Gets the current controller when it is a player controller.

Call on the game thread. Never searches by player index.

Returns
Non-owning player controller, or null if unavailable, destroying, or controlled by a non-player controller.

◆ GetPlayerState() [1/2]

template<typename T>
T * UNelaricPawnComponent::GetPlayerState ( ) const
inline

Gets the pawn's player state as a specific player state type.

Call on the game thread. Follows GetPlayerState() lifetime.

Template Parameters
TComplete player state type derived from APlayerState.
Returns
Non-owning player state, or null if unavailable or mismatched.

◆ GetPlayerState() [2/2]

GAMEPLAYRUNTIME_API APlayerState * UNelaricPawnComponent::GetPlayerState ( ) const

Gets player state directly from the owning pawn.

Call on the game thread. Does not require a local controller. State may be absent before replication arrives or after unpossession.

Returns
Non-owning player state, or null if unavailable or destroying.

◆ IsLocallyControlled()

GAMEPLAYRUNTIME_API bool UNelaricPawnComponent::IsLocallyControlled ( ) const

Queries the pawn's native local-control semantics.

Call on the game thread. Local control can include AI.

Returns
The pawn's IsLocallyControlled() result, or false without a pawn.

◆ IsPlayerControlled()

GAMEPLAYRUNTIME_API bool UNelaricPawnComponent::IsPlayerControlled ( ) const

Queries the pawn's native player-control semantics.

Call on the game thread. Does not require a player controller to exist locally and does not imply local control or authority.

Returns
The pawn's IsPlayerControlled() result, or false without a pawn.

The documentation for this class was generated from the following file: