I’m trying to use more IAS in my projects, however I can’t find documentation on the specifics of how an InputBinding with KeyCode set to Enum.KeyCode.Unknown behaves. My assumption, in part because “Unknown” is the default value of KeyCode and this property is not allowed to be nil, is that it renders the InputBinding inert - whatever InputAction this InputBinding is a child of will not react whatsoever to any input ever.
I’m seeking clarification on this assumption because I’m wondering if “Unknown” is essentially equivalent to “unbound” / “not set” in the context of an in-experience settings menu that allows for user-modifiable bindings to various gameplay actions. If anyone is aware of any documentation, forum information, or personal experience that supports or contradicts my assumption, I’d appreciate it. Thanks!
I am not aware of any documentation that can define the behaviour of Enum.KeyCode.Unknown, but commonsense reasoning suggests that it would, in fact, render the InputBinding inoperative. Empirical testing can be performed to further justify the conclusion.
Yeah, my first thought was to set the KeyCode to “None” - but obviously this doesn’t exist.
I’m not convinced it’s a “common sense” assumption (although I agree that’s the presumed behavior) that “Unknown” serves the same purpose as a hypothetical “None” KeyCode. For example, UserInputService events will often emit InputObjects with a KeyCode of “Unknown” - in particular for mouse events where UserInputType is MouseButton1/2 (I’m aware we now have MouseButtonLeft/Middle/Right to accommodate these cases). By another perspective of “common sense”, however, one might assume that these events would be equivalent to an InputBinding with a KeyCode of “Unknown”.
As you stated, when an input occurs that is not connected to the keyboard, the associated key code is Enum.KeyCode.Unknown. This is UserInputService’s way of that communicating no input came from the keyboard. This is backed by Unknown’s description: “Blank value that represents no key being pressed.”.
Since InputBinding.KeyCode must be assigned a concrete key code in order to associate a keyboard, or adjacently supported input, with the binding, it is reasonable to assume that Unknown serves as a placeholder indicating the absence of any connected binding.
It is fair to be hesitant of Unknown when it could be better named “None” in this circumstance, but the Input Action System must adhere to what was already becoming of the key code system, lest Roblox reinvent the wheel. Similar instances can be observed throughout the engine, such as OverlapParam.FilterType requiring a RaycastFilterType