How to detect an active Input Action?

Hi, is there a way to detect which Input Action is being Fired? Without doing this?

(see image below)

so what I did is, for every input action, I have to store the ‘input actions name’ to a variable
then used a “Switch on String” and convert that variable to text.

thanks!

1 Like

I mean there probably is a few ways but why do you need to know which fired?

i have a fuction which is being used by 3 Input action, so inside that function i need to detect which input action is firing then do the things i need for that triggering input action?

idk if that made sense, im still a newbie… :smiley:

Just to ensure I understand this you want to have a setup like

Input Action 1 → Generic Function → Stuff happens based on what action was hit

Input Action 2 → Generic Function → Stuff happens based on what action was hit

Correct?

I still don’t know what I’m seeing but shouldn’t an action input be created for each different action?

There is no reason to know which button was pressed, because you want all to trigger the same action.

1 Like

Correct that was going to be my next point lol it should be

Input Action 1 → Specific Function

Input Action 2 → Specific Function

So for example

Run Input Action → Run function

Jump Input Action → Jump function

something like this…

is there a -Flow Control Switch- for input actions? xD

No as you shouldn’t be doing it like that each input Action does their own function they shouldn’t share a function like that.

i see, but i dont want to make a copy of the same fuction for each input action, i actually have 10 Input action for the same function xD

Why? Is the function doing the exact same thing?

its a line tracing function, and which ever IA has a different angle/ direction, so if press 1, then for example, the line trace a certain angle ,…

Exposing the angle as a Function Input should solve this?

1 Like

yes its just a sameple theres more than angle, but i want it inside a function so i wont clutter the main BP

Yep ok that makes sense to be generic so just have the function have an input for angle

So to make this easier instead of switching on a input action pass in an angle and use that instead kinda like this

whoah, Cool Lines, how did u do a straight line for Node Connection?

yes, its really same as this, alot of operators and computation, i have to de clutter my main bp, and the way i do it is always hide it inside of a function…

It is ok to use the same function but I would pass the input to an enums, or a values or expose all variables that is easier to use within the function

1 Like

im still learning about UE, and i haven’t played with enums yet, but ill try enums after this Flow Control, xD nice it looks promising!

2 Likes

You don’t need flow control just add an input to your function (in this case the ange of the line trace) and pass that angle into your equation this way you only need the one function and the one line trace and then you call that function from each input action and you set the angle there so it works for each input action how you expect

2 Likes