RealDocs

UAbilitySystemComponent::OnSpawnedAttributesEndPlayed

function GameplayAbilities Since 4.20
#include "AbilitySystemComponent.h"
Access: public Specifiers: UFUNCTION

Description

Bound to the EndPlay delegate of actors that own spawned attribute sets, so the ASC can remove those attribute sets when the actor leaves play.

Caveats & Gotchas

  • This is an engine-internal callback — do not call it directly. It is registered automatically when attribute sets are spawned onto separate actors.
  • Spawning attribute sets on a different actor than the ASC's owner is an advanced pattern; bypassing this delegate binding will cause attribute data to persist after the attribute actor is destroyed.

Signature

void OnSpawnedAttributesEndPlayed(AActor* InActor, EEndPlayReason::Type EndPlayReason)

Parameters

Name Type Description Default
InActor AActor* The actor whose EndPlay event fired.
EndPlayReason EEndPlayReason::Type The reason EndPlay was triggered.

Return Type

void

Example

Understanding when this fires C++
// Engine binds this internally when AddSpawnedAttribute is used with
// an attribute set owned by a different actor:
UMyAttributeSet* AttrSet = NewObject<UMyAttributeSet>(SomeOtherActor);
ASC->AddSpawnedAttribute(AttrSet);
// When SomeOtherActor calls EndPlay, OnSpawnedAttributesEndPlayed fires automatically.

Version History

Introduced in: 4.20

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.