How to hook up my GAS code with my EnhancedInput?

Basically what it says in the topic :slight_smile:

I have created my custom AbilitySystemComponent, a bunch of ablities etc.
I have also started implementing Enhanced Input as well.

Rather than do things the manual way, i.e. bind some actions to some custom functions in my PlayerController (not using my Character classes personally) that call some abilities (try activate ability etc), isn’t there a way to do this with existing Epic code? I notice that in the AbilitySystem’s engine code. I also notice some BP nodes with tasks like Wait for Input Release etc., so it would be nice to have those two systems in harmony with each other.

Are there resources available on this? Tutorials? Example code somewhere?

In Lyra they use a LyraInputConfig data asset which maps an Input Action to a Gameplay Tag

Then the you just set the Gameplay Ability to trigger from a given Gameplay Tag and bingo bango.

I don’t know if that is easy to lift out of Lyra and in to your code? Otherwise i guess you will need to bind to the event and apply the gameplay tag yourself in blueprint or something like that.

I have no idea what i am doing so take this with a pinch of salt :wink:

Here is a detailed explanation of how it is done in Lyra https://johnjfarrow.github.io/LyraPart2.html#LyraPart2

1 Like

Thank you for the responses. I remembered that Lyra used a tag system. But I am not using a tag system. I am using the standard built-in plugin for Enhanced Input, which is different in many respects in terms of how it sets up actions and contexts etc, but also similar in the sense that it does bind actions to functions in code. No tags specifically. So I wanted to stick to that, because as I said, I see that the AbilitySystemComponent includes code FActionBindingInfos and such structs. I’m just finding it hard (although I’m still investigating and maybe my understanding of it will come in due time) to navigate the dense code and figure out how to apply it.

I will look into the Lyra explanation, but if it’s tag-based not sure if it will be of much help.

Hi there,

Have you checked this series about GAS?
Chapter 3 shows how to implement enhanced input with c++. I haven’t implemented this series yet, but It’s in my list for sure. Hope that helps.

I mean… gameplay tags are part of GAS so… shrug

Hi there,

My understanding is that GAS and gameplay tags are separated plugins, so one can use gameplay tags without GAS and vice versa, eventhough using both will certainly improve your code.

1 Like

The tags issue is (almost) irrelevant; I’m definitely using tags for my custom GAS. My question was on how to make that ‘talk to’ Enhanced Input with UE’s engine code. To elaborate: there is inside AbilitySystemComponent.h, for example, a ‘BindToInputComponent’, a ‘BindAbilityActivationToInputComponent’ or ‘AbilitySpecInputPressed/Released’ etc. Some of it is a bit fleshed out but some of it is bare-bones and I believe it is meant to be overridden. I was just asking to see if there are examples of such usage or a specific tutorial showing exactly how to combine Enhanced Input actions used to activate Abilities (whether with tags or without tags). I hope that makes sense!

This article is an explanation of how Lyra connects hardware inputs and the enhanced input system with gameplay tags and gameplay abilities [Looking into Lyra - Part 2 - Inputs & GAS | unrealcode.net)

2 Likes

Thank you for sharing, it contains very detailed information. Well done.

Hey, here is a tutorial about the clean and simple way to bind Gameplay Abilities to Enhanced Input: