RealDocs

UAbilitySystemComponent::GetGameplayTaskAvatar

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

Description

Returns the avatar actor to use for the given gameplay task, implementing the IGameplayTaskOwnerInterface contract. Normally returns the same actor as GetAvatarActor().

Caveats & Gotchas

  • This implements IGameplayTaskOwnerInterface::GetGameplayTaskAvatar and is called by the Gameplay Task system internally — do not call it directly when you want the avatar; use GetAvatarActor() instead.
  • Override this when tasks need a different avatar than the default (e.g. a vehicle turret ability acting on a different mesh actor than the owning vehicle pawn).

Signature

UE_API virtual AActor* GetGameplayTaskAvatar(const UGameplayTask* Task) const override

Parameters

Name Type Description Default
Task const UGameplayTask* The task requesting the avatar actor (may be null for a default query).

Return Type

AActor*

Example

Override for a multi-actor ability system C++
AActor* UMyASC::GetGameplayTaskAvatar(const UGameplayTask* Task) const
{
    // Use a secondary avatar for turret abilities
    if (Task && Task->IsA<UMyTurretTask>())
    {
        return TurretActor.Get();
    }
    return Super::GetGameplayTaskAvatar(Task);
}

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.