UI input needs improvement

As a scripter & UI designer, I have a ton of experience programming UIs. The things I’ve always found the most annoying and hardest to use have always been the input-related aspects.

At the moment, it feels like the current system for detecting input is un-intuitive and badly designed, making it harder for everyone to make (and learn to make) working UI content on the platform.

Older features seem to be being ignored, while new stuff is being added over the inconsistent system, confusing newer developers & making the jobs experienced developers harder.

Un-intuitive

At the moment, you’ve got about 4 options for detecting UI input:

  • UserInputService (+ RunService + lots of math)
  • ContextActionService (+ RunService + lots of math)
  • Input events on GUI objects (i.e. InputBegan)
  • Pre-made input events on GUI object (i.e. MouseButton1Down)

There are two things that I’ve noticed: It’s not very clear which ones should be used, and it’s messy.

For beginners, the pre-made input events seem to be the first and best choice, until they encounter one of the weird issues that they can’t work around with their current knowledge. These default button events end up being redundant to us more experienced developers because they don’t work well and can’t be customized at all.

For example, two of the default button events don’t even work properly; MouseEnter and MouseLeave. And yet the spammed bug reports are ignored.

Images


Screenshot_930

This often requires developers to use other methods of detecting input; in my case I’ve been using Object.InputBegan and Object.InputEnded heaps. These methods were not designed to be used specifically for buttons, however, so they take longer to implement and shouldn’t be the proper way of doing stuff.

Input right now to me seems like a mess of services and events and methods. It needs to be consolidated into one sensible system. Look at the list above, and also add on all of the things gamepad & touch input use.
There aren’t really any unique services for them, but definitely the properties & methods of UIS – a service which is a kind of confusing mix of stuff directly related to UIs and stuff that isn’t.

Bad Design

Another big thing I’ve noticed is that stuff is just kind of added or combined with already-existing features, with what seems to be no thought towards whether it makes sense or would be good to use differently.

For example, MouseButton1Down should not fire for controllers, period. But as it’s the only default method of detecting input on a GUI button object, so it’s been used for cross-platform work (even when it has Mouse in the name!).

Ideas

An engine you might know I look up to is Godot Engine. I think it has some pretty good examples of input detection that could implemented similarly in Roblox.

Firstly, the main button event is called pressed, and it is emitted when a mouse or a touch or a controller button starts input on it (it’s also customisable so you can choose whether it fires on a ‘click’ or on ‘up’ instead of ‘down’, but that’s mostly besides the point). It has a generic name and works as expected.

A thing that I really like about the Input signals on GUI objects in Roblox currently is that they work for all objects, not just buttons.
Godot Engine follows this logic, so signals like mouse_entered and mouse_exited can work as expected for all objects.

But those are just the default events. While they’re useful, they need to be customisable, for unique games & different platforms. Maybe some sort of GuiInputService, or just a clean-up and renewal of existing things might help.

14 Likes

Agreed, there’s currently a high demand for hacky solutions in UI-related items. For instance, the gun scripts in PUBG Mobile would be tough to replicate in roblox because the fire button can be dragged on in PUBG to rotate the camera. In roblox, this would be impossible to do with the current ImageButton, and would require getting the mouse’s UDim position and comparing it to the frame’s UDim position. Bottom line is that it would be extremely annoying, and it needs revamping.

2 Likes

Oh, this is much needed and I agree with you as well. As a UI designer myself it gets hard using the input aspects.

2 Likes