"Unknown" being sent as input

In our game Notoriety, we have the ability for users to edit their keybinds in a menu. Part of that is disabling a keybind, which we set in their data to Enum.KeyCode.Unknown, which, up until recently, effectively disabled it as we didn’t expect them to ever come through as user input.

Here’s an example of what some users are experiencing who had unbound their ‘weapon switch’ key. Every time they touch their screen it triggers
WARNING: Loud music

I have attached a blank baseplate repo file below, but interestingly this doesn’t show up when using studios emulator, it only shows up on the mobile client. In this case, I tested on IOS.
mobileIssue.rbxl (77.2 KB)
You should be able to publish and run on a mobile device to see the following output:

Reports started coming in around the 21st of July.

Expected behavior

I wouldn’t expect Unknown to come through to user input service, as this was something we have been relying on for quite some time with no trouble.

hi,

couldn’t a temporary fix be to make a module where it filters out the unknown keycap?

Yep, rolling out a fix for that now. That’s the quickest solution

1 Like

Truthfully, mobile devices should return KeyCode.None instead of Unknown, so something must have definitely changed for this to happen


Yeah. On PC I can use the test file I sent and click around and get None, but the behavior is totally different on mobile

Hi,

In engine version 731 we released a change that aliases the KeyCode.Unknown enum to KeyCode.None but preserves the same value. I believe this version is released to Studio and all clients other than iOS which may explain the behavior you are seeing. Can you let me know a bit more on your issue - are you doing direct string comparison of the enum name?

Hello, our code resembled this:

io.KeyCode.Name == options:WaitForChild("Keybinds"):WaitForChild("ToggleGun").Value

where the options:WaitForChild("Keybinds"):WaitForChild("ToggleGun").Value was the stored string that was in this case, "Unknown"


It seems that LMB/RMB now trigger None? Was this part of the engine change?

Hi, the change should have just been a rename, and unfortunately we are not able to support direct string comparison of enum names with this update. I apologize for the issue this caused.

As for the issue with LMB/RMB triggering None, could you provide some more details? This should not be an intended part of the engine change, with UserInputService a mouse left/right click should continue firing an InputObject with UserInputType.MouseButton1/2 and KeyCode.None (previously Unknown).

I see. Basically, we were storing the Unknown value as a string in datastores since we can’t serialize enums directly.
image
Now we must check for stale “Unknown” keybinds from engine v 720 730, and for engine v 721 731, we have to make sure that any None keybinds coming through don’t match with our unbound keybinds. I think Notoriety might be a bit unique in that we allow users to unbind keys. We are monitoring to see if this has been fully resolved, but we did deploy an attempt at a fix.

Thanks for getting back to me, I understand. Are you able to serialize the value of the enum (perhaps convert from int to string) rather than the string name?

print(Enum.KeyCode.Unknown.Value)
print(Enum.KeyCode.None.Value)

I think both of these should resolve to 0.

Please keep us updated on the results of your fix and if you encounter any additional issues! Once again, I apologize that this change caused problems and thank you for your patience with us.

We were able to mitigate this using above code to help, thank you!