tranek / GASShooter

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

Interaction Prompt stays if object is killed #17

Open philspaz opened 3 years ago

philspaz commented 3 years ago

If you kill a character that is able to be revived, the revive prompt doesn't go away. I think I've fixed it in GSAT_WaitInteractableTarget.cpp in the block of code starting at 221.

if (!ReturnHitResult.bBlockingHit) { // No valid, available Interactable Actor

    //ReturnHitResult.Location = TraceEnd;   <----------Remove
    if (TargetData.Num() > 0 /*&& (TargetData.Get(0)->GetHitResult()->Actor.Get()*/)  <------Change
    {
        // Previous trace had a valid Interactable Actor, now we don't have one
        // Broadcast last valid target
        LostInteractableTarget.Broadcast(TargetData);
        TargetData.Clear();       <-------Add
    }

    //TargetData = MakeTargetData(ReturnHitResult);   <------Remove
}

this was causing TargetData.Num() > 0 to always be true which was fine unless the actor in the data just up and disappeared. I'm assuming it's because the reference to the actor isn't valid anymore so it comes back as false when you need it to be true. Hope that helps and doesn't cause more issues... Sorry, I don't know how to do the whole pull request stuff, I'm not really a programmer.

Phil

tranek commented 3 years ago

I don't really know a good way to test this one by myself without another person. The joys of multiplayer development.

This code isn't meant to be a production-ready example -- just one way to do an interaction system purely using abilities for the sake of doing it only with abilities.

I'll leave this bug report open but I have no intention of fixing it. Thanks for reporting!