Can we please get a built-in interaction that triggers ONCE, not two or three times, when a button is pressed and then not again until it is released and pressed again? Basically, like the old OnButtonDown, which I guess is the most often used of the old calls?
Yes, we can check the context all the time. But why? And if I want to invoke Unity Events and link them into something that doesn’t care where its input is coming from, then it gets very tedious.
For example, in my game you can change the game speed up/down with either the +/- keys on the keyboard, or with UI keys. The UI keys simply call Slower() and Faster() functions. Wouldn’t it be cool if I could set up the Input System so that it calls the same darn functions via Invoke Unity Events? That would be sweet, wouldn’t it?
Sadly, no such luck, because by default it will call it three times, and even with the “Press” interaction, it’ll still call it two times.
I’m switching to the new Input System because I need the configurability of keys. But so far, I’m pretty disappointed by how many basic convenience things it is lacking and how convoluted some really simple things are.
Have you added the same Interaction to both the Binding and parent Action by mistake? That can cause multiple performed events being sent for what you think is a single Press interaction.
No. My problem is not multiple performed events. My problem is that I get started, performed and cancelled. But I only want to get ONE Unity Event invoked, not all three (or two if you use the Press interaction).
It’s insane that the Input System doesn’t by itself provide functionality for the most common “did the user press a button?” function, and insists on telling you stuff you don’t want to know (“hey, he started pressing a button!”, “hey, now he pressed it most of the way!”, “hey, he also released it!” - yeah, I guess he’s doing all of that but I really, really don’t care one bit).
I’m apparently not explaining myself well. Yes, of course I can write additional code to do what the system should be doing already by itself.
But if I’ve learnt anything then that tightly coupled code is crap. My actual game code should know as little as possible about where the input comes from and which shape it takes. The input system should just call “PauseGame()”, or send a “PauseGame” Message or whatever.
And it does that - you can hook up Unity Events, right? But those Unity Events get triggered THREE TIMES, with an input context, meaning they need to understand and evaluate the Input System. I want to decouple that.
Right now, I literally have a class called ManageInputSystemStupidity which receives the Input System events, strips them down and hands them on. In short: It does what should be an option inside the Input System.
I fully understand that for some use cases you need all the complexity, that sometimes you want to track, say, started and performed seperately. But in many, many use cases you don’t. You just want to frigging know if the user pressed a button. In fact, the “Press” interaction should do that, except that for whatever unexplained reason it sends both “started” and “performed” events.
I dunno, man. If I use the GUI for setting up my Action Maps, etc. then I need one line of code to hook it up to a function call, which is only called once. The new Input System is certainly more complicated in general than the old one, and it takes a while to figure out how to use it for simpler setups, mostly because there are multiple ways to do things, but it’s possible. The additional exposed complexity is actually to de-couple input management from your code, which honestly, once you have the right implementation for your codebase, it does.
We have different interpretations of what decoupling means. I run most communication between parts of my code through events and scriptable objects. No part of my code needs to know how another part of my code works. Now I’m breaking that principle by forcing everything that needs to handle input deal with started, performed, canceled, even if it’s as simple as a button press?