UAbilitySystemComponent::ClearActorInfo
#include "AbilitySystemComponent.h"
Access: public
Specifiers: virtual
Description
Clears the owner and avatar actor references from the AbilityActorInfo structure. Called automatically when the owning actor is destroyed to prevent dangling pointers in active abilities.
Caveats & Gotchas
- • Does NOT cancel active abilities — abilities may continue to tick with a null avatar/owner until they naturally end or are force-cancelled. If you need a clean shutdown, cancel all abilities before or after calling this.
- • After this call, GetAvatarActor() and GetOwnerActor() return nullptr. Any ability code that caches these without checking will crash. Always null-check after possession changes.
- • In a PlayerState-owned ASC, this is typically called when the pawn unpossesses — not when the PlayerState is destroyed. The distinction matters for respawn flows.
Signature
UE_API virtual void ClearActorInfo(); Return Type
void Example
Manual cleanup on unpossess C++
void AMyCharacter::UnPossessed()
{
Super::UnPossessed();
// If ASC is on PlayerState, clear avatar so stale pawn isn't referenced
if (UAbilitySystemComponent* ASC = GetAbilitySystemComponent())
{
ASC->ClearActorInfo();
}
} See Also
Version History
Introduced in: 4.15
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?