RealDocs

ACharacter::UnPossessed

function Engine Since 4.0
#include "GameFramework/Character.h"
Access: public Specifiers: virtualoverride

Description

Called on the server when the controller releases possession of this Character. ACharacter notifies the CharacterMovementComponent so it can disable client prediction and switch to simulated proxy behaviour.

Caveats & Gotchas

  • Like PossessedBy, this is server-only. If you want to react on the client when the pawn becomes uncontrolled, use `OnRep_Controller` instead.
  • After Super::UnPossessed() the `Controller` member is null; do not dereference it in the remainder of your override without a null check.

Signature

ENGINE_API virtual void UnPossessed() override;

Return Type

void

Example

Clean up controller-bound state on unpossession C++
void AMyCharacter::UnPossessed()
{
    // Revoke abilities tied to this controller before clearing the reference
    if (AbilitySystemComponent && Controller)
    {
        AbilitySystemComponent->ClearAllAbilities();
    }
    Super::UnPossessed();
}

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.