tranek / GASDocumentation

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

Local GameplayCues using AvatarActor to emulate properly the behavior of a normal GameplayCue #118

Open linqen opened 1 year ago

linqen commented 1 year ago

The current behavior of the example GameplayCueLocal functions is not working as it would do with a normal GameplayCue.

If we use GetOwner, the gameplay cue will always be executed sending the owner as "MyTarget", inside the GameplayCue.

In case our ASC lives on the PlayerState, and our Character is the Avatar, this will result on inconsistent behavior between executing the GC using this new function, and the normal Execute/Add GameplayCue

GetAvatarActor() instead of GetOwner() fixes this issue.

Check UAbilitySystemComponent::InvokeGameplayCueEvent to confirm that this is the default/expected behavior.

linqen commented 9 months ago

@tranek is it possible to take a look at this? I think just looking at the code makes completely sense.

GetAvatarActor will return the same as GetOwner when the Owner is AvatarActor, but will also return the proper actor when Avatar != Owner