UAbilitySystemComponent::OnUnregister
#include "AbilitySystemComponent.h"
Access: public
Specifiers: virtualoverride
Description
Called when the component is unregistered from its owning actor. The GAS override cancels active abilities, removes gameplay effects, and deregisters with the global AbilitySystem subsystem.
Caveats & Gotchas
- • Always call Super::OnUnregister(). The base implementation performs critical cleanup — active effects and abilities that are not ended here can leave dangling timer/delegate handles.
- • This is called both during actor destroy and when a component is explicitly removed at runtime. Ensure your override logic handles both scenarios correctly.
- • If you have custom delegates or timers that reference the ASC, clear them before calling Super::OnUnregister() to avoid them firing during the super's cleanup phase.
Signature
UE_API virtual void OnUnregister() override; Return Type
void Example
Override with cleanup before super C++
void UMyAbilitySystemComponent::OnUnregister()
{
// Clear any custom handles/delegates before super tears everything down
MyCustomHandle.Invalidate();
Super::OnUnregister();
} Version History
Introduced in: 4.15
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?