| Post Reply | RetroFed Forum Forum Index » Game Development |
| Author | Message | ||
|---|---|---|---|
RougeEric
lemmy.zip
RougeEric@lemmy.zipJoined: 2025-06-30 |
A few years ago I decided to fix my biggest gripe with Unity's InputSystem: there is no intuitive and fuss-free way of determining which UI, character controller, popup, etc. should be receiving inputs at any given time. So I started working on a system that sort of "automatically" handles all the mess for me and handles the complexity on its own. You can get InputLayers for free on the asset store.What is InputLayers?The short version is that it's a system that lets you assign input actions to layers that "stack" priority. So when your popup comes up on screen, its layer is added to the top of the stack; and as long as no other layer takes its place, only inputs from that layer will be taken into account. Video overviewI go over the core idea in a little bit more detail in this video: https://youtube.com/watch?v=bXEuzpbGlCI Sample scenesI've included a few sample scenes that cover most of the basic use cases. Their code is a bit complex if you're unfamiliar with UI Toolkit, but I've mostly isolated the fussy stuff so you can concentrate on understanding how the actual InputLayers stuff get handled. DocumentationI've set up the documentation over on GitHub for ease of access; and so that people can post issues they may encounter easily. |
||
| 12 Original | |||
Sanctus
anarchist.nexus
Sanctus@anarchist.nexusJoined: 2025-09-08 |
This is really amazing, in my opinion Unity's InputSystem is servicible but not mind blowing. My pain points would always arise with menus when returning to a scene, especially when I was in school. They should bundle your tool as a permanent part of Unity honestly this is awesome. Unfortunately I am all in on Godot but I'll pass this to my friends who still use Unity! |
||
| 5 | |||
RougeEric
lemmy.zip
RougeEric@lemmy.zipJoined: 2025-06-30 |
This is really amazing, in my opinion Unity's InputSystem is servicible but not mind blowing. My pain points would always arise with menus when returning to a scene, especially when I was in school. They should bundle your tool as a permanent part of Unity honestly this is awesome. Unfortunately I am all in on Godot but I'll pass this to my friends who still use Unity!
Thanks!! TBH, I'm probably going to switch over to Godot at some point myself as well. |
||
| 2 | |||
Sanctus
anarchist.nexus
Sanctus@anarchist.nexusJoined: 2025-09-08 |
Thanks!! TBH, I'm probably going to switch over to Godot at some point myself as well.
Cant recommend it enough. Its amazing. |
||
| 2 | |||
I Cast Fist
programming.dev
ICastFist@programming.devJoined: 2023-06-22 |
Thanks!! TBH, I'm probably going to switch over to Godot at some point myself as well.
I hate how Godot has an array of mapped buttons to a specific action, but denies you direct access to change them in the order they're in. This is problematic if your game has the main keybind + secondary + controller for the same action and you want to let players rebind them all. It could also use something like that layeredInput, since it can be a bit of a juggle to ensure that 2 open windows don't close if you press |
||
| 2 | |||
RougeEric
lemmy.zip
RougeEric@lemmy.zipJoined: 2025-06-30 |
I hate how Godot has an array of mapped buttons to a specific action, but denies you direct access to change them in the order they're in. This is problematic if your game has the main keybind + secondary + controller for the same action and you want to let players rebind them all. It could also use something like that layeredInput, since it can be a bit of a juggle to ensure that 2 open window...
Not sure if I'll ever get around to adapting the concept to Godot, but I'd be happy if anyone comes around and takes the core logic that's there and adapts it ;) |
||
| 1 | |||
I Cast Fist
programming.dev
ICastFist@programming.devJoined: 2023-06-22 |
Not sure if I'll ever get around to adapting the concept to Godot, but I'd be happy if anyone comes around and takes the core logic that's there and adapts it ;)
Without actually looking at your code, the first thing that came to mind is making something akin to the Collision masks that nearly every node has, where you just set a value and, during the game's runtime, input processing checks every node that has the same value - for instance, if opening a menu set the InputLayer to 2, only nodes that are of value 2 will process, every other will ignore. So, one extra variable and one extra check before processing any input |
||
| 2 | |||
RougeEric
lemmy.zip
RougeEric@lemmy.zipJoined: 2025-06-30 |
Without actually looking at your code, the first thing that came to mind is making something akin to the Collision masks that nearly every node has, where you just set a value and, during the game's runtime, input processing checks every node that has the same value - for instance, if opening a menu set the InputLayer to 2, only nodes that are of value 2 will process, every other will ignore. S...
I went with a stack pattern and priorities. Within a priority the last "layer" to activate is the only one to receive inputs. The priority system just means that if a layer from a lower priority gets activated, it doesn't take over until the upper layer is empty. It's a bit stricter (only one layer active at all times), but you can always subscribe to inputs from multiple layers to achieve what you were describing. The main advantage here was that you can safely rely on enabling/disabling layers without ever getting a conflict... If some popup comes in over your menu, the popup is in charge until it's closed. No need for them to communicate, and you reliably know that inputs will eventually return to the menu properly, even if something else gets interposed. And since it's tacked onto the existing system, you can always have parts of the code that ignore the layer system entirely if necessary (like a mute button that has to work across all systems/menus for example). |
||
| 2 | |||
| Post Reply |
Back to top |