Cancel Enhanced Input System (w/ Hold)?

How can I cancel an enhanced input action? Specifically one with a Hold trigger.

I found Make InputCancelAction that seems to be for exactly this purpose, but I can’t seem to find where it goes.

Thank you.

EDIT

For anyone coming along wondering about canceling inputs, it definitely isn’t possible in BP. The FInputCancelAction pictured above is only used for combo actions. Below is the only place in the entire code base that it’s used

In C++ you might be able to do something with UEnhancedPlayerInput::FindOrAddActionEventData and specifically the FInputActionInstance that it adds, but I haven’t tried it myself.

1 Like

Hey there @rokenrock! Depending on your modifiers, the only way for a Hold type input action to output canceled is if your hold doesn’t make it to the hold timer threshold and is released. It should output completed once it holds however. Hold and release works similarly but won’t use complete until release.

1 Like

Yeah I can’t find anything either. There doesn’t seem to be a way to prematurely cancel a specific action through BP. InputCancelAction really is a mystery.

In the end I just made a basic system to allow me to tell when it was finished and cancelled based on a variable length of hold time. This is better anyways since now I can have multiple hold durations, but I still wonder what InputCancelAction can be used by…

Understandable! I’d usually recommend post processing inputs that aren’t meant to always run after the fact anyway as it’s more flexible than trying to stop the input directly. Though I agree, I’m not sure the use case for the cancel action, as I don’t even have an entry for it in a base project.

1 Like

You have to make two Enhanced Input Mapping objects inside of your Input Mapping Context – one for Hold, and one for Release.

Then in your blueprint, you have to have two events, one for each:

I agree, the Hold trigger should fire the Completed event when the key is released, but it doesn’t. It fires it right after you start holding… which actually makes sense if you think about it. Anyway, cheers!

1 Like

perhaps something simpler like so?

This is probably the best way to do it. Might be different for a hold though- might need to connect enter to ongoing instead of triggered

Though it doesn’t really matter to me since I’m doing something completely different.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.