tranek / GASDocumentation

My understanding of Unreal Engine 5's GameplayAbilitySystem plugin with a simple multiplayer sample project.
MIT License
4.41k stars 809 forks source link

Dynamic GE Creation #53

Closed ughstudios closed 3 years ago

ughstudios commented 3 years ago

Received PreReplicatedRemove with no UGameplayEffect def.

Not sure why but I get this error when I create a GE dynamically. This is my code:

        UGameplayEffect* GE_StatusEffect = NewObject<UGameplayEffect>(GetTransientPackage(),
                                                                  FName(TEXT("StatusEffect")));
    GE_StatusEffect->DurationPolicy = EGameplayEffectDurationType::HasDuration;
    GE_StatusEffect->DurationMagnitude = FGameplayEffectModifierMagnitude(FScalableFloat(Duration));

    // Add one new modifier to the list. 
    const int32 Idx = GE_StatusEffect->Modifiers.Num();
    GE_StatusEffect->Modifiers.SetNum(Idx + 1);
    FGameplayModifierInfo& ModifierInfo = GE_StatusEffect->Modifiers[Idx];
    GE_StatusEffect->InheritableOwnedTagsContainer.AddTag(FGameplayTag::RequestGameplayTag(FName("Status.Slowed")));
    ModifierInfo.ModifierMagnitude = FScalableFloat(Magnitude);
    ModifierInfo.ModifierOp = ModOp;
        ModifierInfo.Attribute = UMy_AttributeSet::GetMovementSpeedAttribute();
ughstudios commented 3 years ago

I'm wondering if like, the gameplay effect spec or the gameplay effect is being garbage collected after function call, so it's not being shown. I'm going to try and store them in a TArray marked with UPROPERTY() to see if that fixes it.

ughstudios commented 3 years ago

image

ughstudios commented 3 years ago

Didn't seem to do anything sadly.

tranek commented 3 years ago

Hello, these issues are only for bugs in the sample project or issues directly with the readme. For technical help, I'd suggest trying the Unreal Slackers Discord Server, the official UE Forums, or the UE AnswerHub.

omrumcetin commented 1 year ago

Any solution to this ?

tranek commented 1 year ago

Nope.