tranek / GASShooter

Advanced FPS/TPS Sample Project for Unreal Engine 4's GameplayAbilitySystem plugin
MIT License
953 stars 265 forks source link

Crash with the EffectContext, TargetData and AddTargetData in the Shotgun Instant GA #36

Open Aziryel opened 1 year ago

Aziryel commented 1 year ago

When I try to run the HandleTargetData custom event in the Shotgun Instant GA everything runs just fine until I get to the AddTargetData, if I use a print before that (Get Effect Context) everything runs but after I connect the Get Effect Context to the AddTargetData and I try to run it, it crashes. Please help!

Aziryel commented 1 year ago

I managed to focus the issue to the AddTargetData, for some reason after the EffectContext is assigned using the static_cast and the EffectContext->AddTargetData(TargetData) is called the engine crashes and the AddTargetData is not even called (I tried by using an UE_LOG but nothing happens. I already checked if the EffectContext was valid and if the TargetData has the information and I was able to obtain the actors and hitResults so they are both valid but the AddTargetData is not working, any idea why?

ameaninglessname commented 1 year ago

Does the EffectContext have "correct" type for static_cast, it's not null dost not mean valid, static_cast only checks at compile-time.

Or the AddTargetData is overridden by derived class causing the crash?

Aziryel commented 1 year ago

Yeah the static_cast for the EffectContext is the same as in the GSShooter, FGASGameplayEffectContext EffectContext = static_cast<FGASGameplayEffectContext>(EffectContextHandle.Get()); FGASGameplayEffectContext being the same as FGSGameplayEffectContext and the EffectContextHandle is the type FGameplayEffectContextHandle.

The AddTargetData function is in the structure FGASGameplayEffectContext but the engine crashes before it can fully call it by EffectContext->AddTargetData(TargetData)