RealDocs

UAbilitySystemComponent::SetOwnerActor

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

Description

Sets the logical owner actor for this component without triggering a full InitAbilityActorInfo refresh. Use this when the owner changes independently of the avatar (e.g. during possession transfer).

Caveats & Gotchas

  • This does not update AbilityActorInfo — you must call InitAbilityActorInfo or RefreshAbilityActorInfo afterward for abilities to see the new owner.
  • Do not confuse OwnerActor with the UActorComponent's GetOwner() — in GAS the owner is the logical controller (often a PlayerState) while the component may be on a different actor (the Pawn).

Signature

UE_API void SetOwnerActor(AActor* NewOwnerActor)

Parameters

Name Type Description Default
NewOwnerActor AActor* The actor that logically owns this ability system component.

Return Type

void

Example

Update owner during possession C++
// Called on the server when a new controller possesses the pawn:
void AMyPawn::PossessedBy(AController* NewController)
{
    Super::PossessedBy(NewController);
    AMyPlayerState* PS = GetPlayerState<AMyPlayerState>();
    if (PS)
    {
        UAbilitySystemComponent* ASC = PS->GetAbilitySystemComponent();
        ASC->SetOwnerActor(PS);
        ASC->InitAbilityActorInfo(PS, this);
    }
}

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.