UAbilitySystemComponent::GetAvatarActor_Direct
#include "AbilitySystemComponent.h"
Access: public
Specifiers: const
Description
Returns the raw AvatarActor pointer stored in this component. Prefer GetAvatarActor() (which goes through AbilityActorInfo) unless you specifically need the raw cached pointer.
Caveats & Gotchas
- • This can return a stale or null pointer if the avatar was destroyed and OnAvatarActorDestroyed cleared it — always check IsValid() before use.
- • GetAvatarActor() (no _Direct suffix) returns the actor via AbilityActorInfo, which is the preferred path in ability code; _Direct bypasses that indirection.
Signature
AActor* GetAvatarActor_Direct() const { return AvatarActor; } Return Type
AActor* Example
Quick null-check before ability logic C++
AActor* Avatar = ASC->GetAvatarActor_Direct();
if (!IsValid(Avatar))
{
return; // Avatar was destroyed
}
APawn* AvatarPawn = Cast<APawn>(Avatar); Tags
Version History
Introduced in: 4.15
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?