RealDocs

UAbilitySystemComponent::SetAvatarActor

function GameplayAbilities Since 4.15
#include "AbilitySystemComponent.h"
Access: public

Description

Changes the avatar actor while keeping the owner actor the same. Use this when possession changes or the physical representation of the character swaps mid-gameplay.

Caveats & Gotchas

  • This re-initializes the AbilityActorInfo structure (locomotion component, mesh, anim instance references), so any cached pointers held by active abilities may become stale after this call.
  • Unlike InitAbilityActorInfo which sets both owner and avatar, this only updates the avatar side — the owner actor remains unchanged. Verify this is the behavior you want when called during possession changes.
  • Does NOT automatically cancel running abilities or reapply attribute-based effects tied to the avatar. If the new avatar has a different skeleton or attribute set, validate manually.

Signature

UE_API void SetAvatarActor(AActor* InAvatarActor);

Parameters

Name Type Description Default
InAvatarActor AActor* The new actor to use as the avatar for this ability system component.

Return Type

void

Example

Update avatar on possession C++
void AMyPlayerState::OnPossessedPawnChanged(APawn* OldPawn, APawn* NewPawn)
{
    if (UAbilitySystemComponent* ASC = GetAbilitySystemComponent())
    {
        ASC->SetAvatarActor(NewPawn);
    }
}

Version History

Introduced in: 4.15

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.