RealDocs

APawn::PossessedBy

function Engine Since 4.0
#include "GameFramework/Pawn.h"
Access: public Specifiers: virtual

Description

Called on the server (or in standalone) immediately after a controller takes possession of this pawn. Override to run server-side setup that depends on knowing who is in control.

Caveats & Gotchas

  • Only called on the server or in standalone — never on client machines. Use `ReceivePossessed` (the Blueprint event) if you also need to react on the client side, but note that event is also server/authority only.
  • The `Controller` pointer is already set when this is called, so `GetController()` is valid inside the override. Calling `Super::PossessedBy()` is important — it sets up the player state reference and fires `ReceivePossessed`.

Signature

virtual void PossessedBy(AController* NewController)

Parameters

Name Type Description Default
NewController AController* The controller that has just taken possession of this pawn.

Return Type

void

Example

Grant abilities on possession C++
void AMyPawn::PossessedBy(AController* NewController)
{
	Super::PossessedBy(NewController);
	if (AbilitySystemComponent)
	{
		AbilitySystemComponent->InitAbilityActorInfo(this, this);
	}
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.