#[5.3 Fix] InheritableOwnedTagsContainer deprecated and fails to work

39 messages · Page 1 of 1 (latest)

stoic rivet
#

Encountered this in section 309 Dynamic Gameplay Effects.

Debuff effects will fail in UE5.3 because the burn tag is not applied to the target. InheritableOwnedTagsContainer is marked as deprecated, but it actually fails to work in 5.3. The warning was clear as mud:

UE_DEPRECATED(5.3, "Inheritable Owned Tags Container is deprecated. To configure, add a UTargetTagsGameplayEffectComponent. To access, use GetGrantedTags.")

After some, research, and trial and error, I found the following fix. The workaround is to replace:

Effect->InheritableOwnedTagsContainer.AddTag(GameplayTags.DamageTypesToDebuffs[DamageType]);

with:

UTargetTagsGameplayEffectComponent& AssetTagsComponent = 
                Effect->FindOrAddComponent<UTargetTagsGameplayEffectComponent>();
FInheritedTagContainer InheritedTagContainer;
InheritedTagContainer.Added.AddTag(GameplayTags.DamageTypesToDebuffs[DamageType]);
AssetTagsComponent.SetAndApplyTargetTagChanges(InheritedTagContainer);
stoic rivet
#

Note that the following also works, but there are all sorts of warnings in the header to not modify this at runtime:

Effect->CachedGrantedTags.AddTag(GameplayTags.DamageTypesToDebuffs[DamageType]);

So I believe that the somewhat more complex solution in the first post above is the correct and safer solution.

stoic rivet
#

Here is what the fix looks like in section 334. Stun:

UTargetTagsGameplayEffectComponent& AssetTagsComponent = Effect->FindOrAddComponent<UTargetTagsGameplayEffectComponent>();
FInheritedTagContainer InheritedTagContainer;
InheritedTagContainer.Added.AddTag(DebuffTag);

if (DebuffTag.MatchesTagExact(GameplayTags.Debuff_Stun))
{
    // Stunned, so block input
    InheritedTagContainer.Added.AddTag(GameplayTags.Player_Block_CursorTrace);
    InheritedTagContainer.Added.AddTag(GameplayTags.Player_Block_InputHeld);
    InheritedTagContainer.Added.AddTag(GameplayTags.Player_Block_InputPressed);
    InheritedTagContainer.Added.AddTag(GameplayTags.Player_Block_InputReleased);
}
AssetTagsComponent.SetAndApplyTargetTagChanges(InheritedTagContainer);
stoic rivet
#

[5.3 Fix] InheritableOwnedTagsContainer deprecated and fails to work

keen bough
#

it's probably worth making a static function then to add and apply an array of tags to an effect

stoic rivet
stoic rivet
#

@vestal canopy I think this is worth pinning as it will trip up people using UE5.3+

vestal canopy
#

Thanks Dot, I put it in the FAQ post for now. When I get time I'll give it more attention

glass plinth
#

for noobs (like me) this is in AuraAttributeSet.cpp and if you are not using Rider make sure to add #include "GameplayEffectComponents/TargetTagsGameplayEffectComponent.h"

sterile night
#

Does this also change the OnRep notify for stunned in AuraCharacter ?

sterile night
vestal canopy
sterile night
#

No worries, I know you have a lot of new content coming out, hard to support the old stuff forever 🙂

vestal canopy
sterile night
#

Sweet, looking forward to that and also the course for server infrastructure

crimson prairie
# stoic rivet Encountered this in section 309 Dynamic Gameplay Effects. Debuff effects will ...

@sterile night

So to fix this issue, within AUraAttributeSet.cpp, I'm replacing this bit

    Effect->InheritableOwnedTagsContainer.AddTag(DebuffTag);
    if (DebuffTag.MatchesTagExact(GameplayTags.Debuff_Stun))
    {
        Effect->InheritableOwnedTagsContainer.AddTag(GameplayTags.Player_Block_CursorTrace);
        Effect->InheritableOwnedTagsContainer.AddTag(GameplayTags.Player_Block_InputHeld);
        Effect->InheritableOwnedTagsContainer.AddTag(GameplayTags.Player_Block_InputPressed);
        Effect->InheritableOwnedTagsContainer.AddTag(GameplayTags.Player_Block_InputReleased);
    }```

With this bit you have posted above

```UTargetTagsGameplayEffectComponent& AssetTagsComponent = Effect->FindOrAddComponent<UTargetTagsGameplayEffectComponent>();
FInheritedTagContainer InheritedTagContainer;
InheritedTagContainer.Added.AddTag(DebuffTag);

if (DebuffTag.MatchesTagExact(GameplayTags.Debuff_Stun))
{
    // Stunned, so block input
    InheritedTagContainer.Added.AddTag(GameplayTags.Player_Block_CursorTrace);
    InheritedTagContainer.Added.AddTag(GameplayTags.Player_Block_InputHeld);
    InheritedTagContainer.Added.AddTag(GameplayTags.Player_Block_InputPressed);
    InheritedTagContainer.Added.AddTag(GameplayTags.Player_Block_InputReleased);
}
AssetTagsComponent.SetAndApplyTargetTagChanges(InheritedTagContainer);```

and adding this include

```#include "GameplayEffectComponents/TargetTagsGameplayEffectComponent.h"```
crimson prairie
#

Not sure what to do here

#

Where is DebuffTag meant to be declared? It was declared already, confusing

sterile night
#

Show me your includes ?

crimson prairie
#
//AuraAttributeSet.cpp

#include "AbilitySystem/AuraAttributeSet.h"

#include "AbilitySystemBlueprintLibrary.h"
#include "AuraAbilityTypes.h"
#include "GameplayTagContainer.h"
#include "GameFramework/Character.h"
#include "GameplayEffectExtension.h"
#include "Net/UnrealNetwork.h"
#include "AuraGameplayTags.h"
#include "AbilitySystem/AuraAbilitySystemLibrary.h"
#include "Interaction/CombatInterface.h"
#include "Interaction/PlayerInterface.h"
#include "Player/AuraPlayerController.h"
#include "GameplayEffectComponents/TargetTagsGameplayEffectComponent.h"
crimson prairie
sterile night
#

#include "AbilitySystem/AuraAttributeSet.h"

#include "AbilitySystemBlueprintLibrary.h"
#include "AuraAbilityTypes.h"
#include "GameFramework/Character.h"
#include "GameplayEffectExtension.h"
#include "Net/UnrealNetwork.h"
#include "AuraGameplayTags.h"
#include "AbilitySystem/AuraAbilitySystemLibrary.h"
#include "GameplayEffectComponents/TargetTagsGameplayEffectComponent.h"
#include "Interaction/CombatInterface.h"
#include "Interaction/PlayerInterface.h"
#include "Player/AuraPlayerController.h"

hmm looks the same as mine

#

Thats my entire Debuff function if it helps

crimson prairie
#

Mine

{
    const FAuraGameplayTags& GameplayTags = FAuraGameplayTags::Get();
    FGameplayEffectContextHandle EffectContext = Props.SourceASC->MakeEffectContext();
    EffectContext.AddSourceObject(Props.SourceAvatarActor);

    const FGameplayTag DamageType = UAuraAbilitySystemLibrary::GetDamageType(Props.EffectContextHandle);
    const float DebuffDamage = UAuraAbilitySystemLibrary::GetDebuffDamage(Props.EffectContextHandle);
    const float DebuffDuration = UAuraAbilitySystemLibrary::GetDebuffDuration(Props.EffectContextHandle);
    const float DebuffFrequency = UAuraAbilitySystemLibrary::GetDebuffFrequency(Props.EffectContextHandle);

    FString DebuffName = FString::Printf(TEXT("DynamicDebuff_%s"), *DamageType.ToString());
    UGameplayEffect* Effect = NewObject<UGameplayEffect>(GetTransientPackage(), FName(DebuffName));

    Effect->DurationPolicy = EGameplayEffectDurationType::HasDuration;
    Effect->Period = DebuffFrequency;
    Effect->DurationMagnitude = FScalableFloat(DebuffDuration);

    FInheritedTagContainer InheritedTagContainer = FInheritedTagContainer();
    UTargetTagsGameplayEffectComponent& AssetTagsComponent = Effect->FindOrAddComponent<UTargetTagsGameplayEffectComponent>();
    
    InheritedTagContainer.Added.AddTag(DebuffTag);
    
    if (DebuffTag.MatchesTagExact(GameplayTags.Debuff_Stun))
    {
        // Stunned, so block input
        InheritedTagContainer.Added.AddTag(GameplayTags.Player_Block_CursorTrace);
        InheritedTagContainer.Added.AddTag(GameplayTags.Player_Block_InputHeld);
        InheritedTagContainer.Added.AddTag(GameplayTags.Player_Block_InputPressed);
        InheritedTagContainer.Added.AddTag(GameplayTags.Player_Block_InputReleased);
    }
    AssetTagsComponent.SetAndApplyTargetTagChanges(InheritedTagContainer);

    Effect->StackingType = EGameplayEffectStackingType::AggregateBySource;
    Effect->StackLimitCount = 1;

    const int32 Index = Effect->Modifiers.Num();
    Effect->Modifiers.Add(FGameplayModifierInfo());
    FGameplayModifierInfo& ModifierInfo = Effect->Modifiers[Index];

    ModifierInfo.ModifierMagnitude = FScalableFloat(DebuffDamage);
    ModifierInfo.ModifierOp = EGameplayModOp::Additive;
    ModifierInfo.Attribute = UAuraAttributeSet::GetIncomingDamageAttribute();

    if (FGameplayEffectSpec* MutableSpec = new FGameplayEffectSpec(Effect, EffectContext, 1.f))
    {
        FAuraGameplayEffectContext* AuraContext = static_cast<FAuraGameplayEffectContext*>(MutableSpec->GetContext().Get());
        TSharedPtr<FGameplayTag> DebuffDamageType = MakeShareable(new FGameplayTag(DamageType));
        AuraContext->SetDamageType(DebuffDamageType);

        Props.TargetASC->ApplyGameplayEffectSpecToSelf(*MutableSpec);
    }
}```
#

There are some differences

#

Yeh I was missing the declaration you have there and another 3 or 4 lines

const FGameplayTag DebuffTag = GameplayTags.DamageTypesToDebuffs[DamageType];

sterile night
#

all G now?

crimson prairie
#

Compiles now

crimson prairie
sterile night
#

Hopefully now you can move forward and untangle the mess of MVVM 😄

crimson prairie
#

yeh lol Thanks for that, I might have to do this again on my actual project as I cloned my repo again just to see how much spaghetti was involved before actually upgrading my project

sterile night
#

Indeed, im curious if you will have to update some of the blueprints too

#

I had to, when I tried stephens exact blueprints on my 5.4 it wouln't get the correct screen

#

compiled, ran etc but wouldnt work

#

so im pretty curious if it will for you

crimson prairie
#

Well already saw this in his video so there should be a fix for that

#

I'm now back to where I was stuck before the upgrade which was just clicking the LoadNewSlot button and not getting the EnterName widget which apprently that video fixes. I will let you know what else breaks :p

#

Looks like they added a notification for the ViewMOdel bindings issue in 5.4

eager venture
#

Hi, I just read the entire forum and I have no idea how to apply this to stun's RepNotify so that the behavior of the tags is replicated on the clients and works correctly