RealDocs

UAbilitySystemComponent::InitAbilityActorInfo

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

Description

Initialises the AbilityActorInfo structure with owner and avatar actors, caching movement component, mesh, anim instance, and player controller references used throughout the GAS system. Must be called before abilities can activate.

Caveats & Gotchas

  • Must be called on both server and owning client — the standard pattern is to call it in PossessedBy (server) and OnRep_PlayerState (client) to handle respawns correctly.
  • Re-calling this after possession changes is required; failing to do so leaves stale mesh/anim references in AbilityActorInfo, which can cause abilities to apply effects to the wrong actor.

Signature

UE_API virtual void InitAbilityActorInfo(AActor* InOwnerActor, AActor* InAvatarActor)

Parameters

Name Type Description Default
InOwnerActor AActor* The actor that logically owns this component (often a PlayerState).
InAvatarActor AActor* The physical actor in the world (often the Pawn). Can be the same as InOwnerActor.

Return Type

void

Example

Standard GAS split-owner setup for pawns C++
// Server: in APawn::PossessedBy
void AMyPawn::PossessedBy(AController* NewController)
{
    Super::PossessedBy(NewController);
    AMyPlayerState* PS = GetPlayerState<AMyPlayerState>();
    if (PS)
    {
        PS->GetAbilitySystemComponent()->InitAbilityActorInfo(PS, this);
    }
}

// Client: in APawn::OnRep_PlayerState
void AMyPawn::OnRep_PlayerState()
{
    Super::OnRep_PlayerState();
    AMyPlayerState* PS = GetPlayerState<AMyPlayerState>();
    if (PS)
    {
        PS->GetAbilitySystemComponent()->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.