In a networked PIE session, when the server has applied a programmatically constructed GameplayEffect that has duration policy = Infinite or HasDuration, this results in a client crash when the client activates a GAS debug HUD with console command
AbilitySystem.DebugAttribute <Attribute>
This crash happens due to the AbilitySystemComponent's ActiveGameplayEffects containing FActiveGameplayEffect entries with Spec.Def == null but
FActiveGameplayEffectsContainer::GetActiveGameplayEffectDataByAttribute()
doesn't take this into account.
Given a character class AMyCharacter, with a UAbilitySystemComponent that has an attribute set UMyAttributeSet with Damage attribute:
void AMyCharacter::BeginPlay()
{
Super::BeginPlay();
if (HasAuthority())
{
UGameplayEffect* GE = NewObject<UGameplayEffect>();
GE->Modifiers.SetNum(1);
GE->Modifiers[0].ModifierMagnitude = FScalableFloat(3.0f);
GE->Modifiers[0].ModifierOp = EGameplayModOp::Additive;
GE->Modifiers[0].Attribute = MyAttributeSet->GetDamageAttribute();
GE->DurationPolicy = EGameplayEffectDurationType::Infinite;
AbilitySystemComp->ApplyGameplayEffectToSelf(GE, 0.0f, AbilitySystemComp->MakeEffectContext());
}
}
AbilitySystem.DebugAttribute Damage
FActiveGameplayEffectsContainer::GetActiveGameplayEffectDataByAttribute(TMultiMap<FGameplayAttribute,FActiveGameplayEffectsContainer::DebugExecutedGameplayEffectData,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<FGameplayAttribute,FActiveGameplayEffectsContainer::DebugExecutedGameplayEffectData,1> > &) GameplayEffect.cpp:4939
UAbilitySystemDebugHUDExtension_Attributes::GetDebugStrings(const AActor *,const UAbilitySystemComponent *,TArray<FString,TSizedDefaultAllocator<32> > &) AbilitySystemDebugHUD.cpp:169
AAbilitySystemDebugHUD::DrawAbilityDebugInfo(UCanvas *,APlayerController *) AbilitySystemDebugHUD.cpp:598
AAbilitySystemDebugHUD::DrawDebugHUD(UCanvas *,APlayerController *) AbilitySystemDebugHUD.cpp:402
[Inlined] Invoke(void (AAbilitySystemDebugHUD::*)(UCanvas *, APlayerController *),AAbilitySystemDebugHUD *&,UCanvas *&&,APlayerController *&&) Invoke.h:66
[Inlined] UE::Core::Private::Tuple::TTupleBase<TIntegerSequence<unsigned int> >::ApplyAfter(void (AAbilitySystemDebugHUD::*&)(UCanvas *, APlayerController *),AAbilitySystemDebugHUD *&,UCanvas *&&,APlayerController *&&) Tuple.h:311
TBaseUObjectMethodDelegateInstance<0,AAbilitySystemDebugHUD,void __cdecl(UCanvas *,APlayerController *),FDefaultDelegateUserPolicy>::ExecuteIfSafe(UCanvas *,APlayerController *) DelegateInstancesImpl.h:665
[Inlined] TMulticastDelegateBase<FDefaultDelegateUserPolicy>::Broadcast(UCanvas *,APlayerController *) MulticastDelegateBase.h:254
[Inlined] TMulticastDelegate<void __cdecl(UCanvas *,APlayerController *),FDefaultDelegateUserPolicy>::Broadcast(UCanvas *,APlayerController *) DelegateSignatureImpl.inl:956
UDebugDrawService::Draw(FEngineShowFlags,UCanvas *) DebugDrawService.cpp:93
UDebugDrawService::Draw(FEngineShowFlags,FViewport *,FSceneView *,FCanvas *,UCanvas *) DebugDrawService.cpp:76
UGameViewportClient::Draw(FViewport *,FCanvas *) GameViewportClient.cpp:1875
FViewport::Draw(bool) UnrealClient.cpp:1852
UEditorEngine::Tick(float,bool) EditorEngine.cpp:2176
UUnrealEdEngine::Tick(float,bool) UnrealEdEngine.cpp:528
FEngineLoop::Tick() LaunchEngineLoop.cpp:5819
[Inlined] EngineTick() Launch.cpp:61
GuardedMain(const wchar_t *) Launch.cpp:190
LaunchWindowsStartup(HINSTANCE__ *,HINSTANCE__ *,char *,int,const wchar_t *) LaunchWindows.cpp:247
WinMain(HINSTANCE__ *,HINSTANCE__ *,char *,int) LaunchWindows.cpp:298
[Inlined] invoke_main() 0x00007ff72ae09426
__scrt_common_main_seh() 0x00007ff72ae09405
<unknown> 0x00007ffa4c177614
<unknown> 0x00007ffa4e0226a1
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-192371 in the post.
1 |
Component | UE - Gameplay - Gameplay Ability System |
---|---|
Affects Versions | 5.2, 5.3 |
Target Fix | 5.4 |
Created | Aug 8, 2023 |
---|---|
Resolved | Aug 23, 2023 |
Updated | Apr 12, 2024 |