APawn::UnPossessed
#include "GameFramework/Pawn.h"
Access: public
Specifiers: virtual
Description
Called on the server (or in standalone) when the current controller stops possessing this pawn. Override to clean up server-side state that was set up in `PossessedBy`.
Caveats & Gotchas
- • Only called server-side. `GetController()` returns the old (departing) controller at the time this is called — it is cleared *after* this function returns.
- • Always call `Super::UnPossessed()` or the input component will not be properly destroyed, leaving stale input bindings.
Signature
virtual void UnPossessed() Return Type
void Example
Remove abilities on unpossession C++
void AMyPawn::UnPossessed()
{
if (AbilitySystemComponent)
{
AbilitySystemComponent->ClearAllAbilities();
}
Super::UnPossessed();
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?