UAttributeSet::GetOwningAbilitySystemComponent
#include "AttributeSet.h"
Access: public
Specifiers: const
Description
Returns the ability system component that owns this attribute set, or nullptr if it isn't registered with one.
Caveats & Gotchas
- • Can return nullptr if the attribute set hasn't been added to an actor's ability system component yet, e.g. during early construction — null-check before use.
- • Resolves the owner via the outer object chain, so an attribute set created without a proper outer (e.g. NewObject with the wrong Outer) will fail to resolve.
Signature
UAbilitySystemComponent* GetOwningAbilitySystemComponent() const Return Type
UAbilitySystemComponent* Example
Query the owning ASC from within an attribute set C++
void UMyHealthSet::PostGameplayEffectExecute(const FGameplayEffectModCallbackData& Data)
{
if (UAbilitySystemComponent* ASC = GetOwningAbilitySystemComponent())
{
ASC->SetNumericAttributeBase(GetHealthAttribute(), FMath::Clamp(GetHealth(), 0.f, GetMaxHealth()));
}
} Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?