Repository navigation
GuiButtons bound with InputBinding.UIButton press their input actions - #40
Merged
Merged
Conversation
A Bool action is held while its binding's UIButton is held down, from the button's MouseButton1Down to its MouseButton1Up (the docs: "a GuiButton press/release through the binding's UIButton property"), so Pressed and Released fire as they do for a key. A key on the same binding doesn't press or release it a second time, and disabled actions and contexts don't take the press. Play sends each GuiButton's MouseButton1Down / Up to the input action system. Estimates (the docs don't say): UIModifier is a second button that has to be held with UIButton, like PrimaryModifier for keys; context Priority and Sink apply to buttons as to keys; a press whose button is hidden or leaves the game before it's let go (no MouseButton1Up) ends when the left mouse button comes up, or as soon as the button leaves the game.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
InputBinding.UIButtonis held from the button's MouseButton1Down to its MouseButton1Up, so Pressed / Released / StateChanged fire as they do for a key. Before this, UIButton was stored but nothing acted on it, so buttons that drive their game through input actions did nothing when clicked.Based on the Roblox docs (create.roblox.com/docs/input/input-action-system: "a GuiButton press/release through the binding's UIButton property"). Estimates, since the docs don't say: UIModifier is a second button held with UIButton, like PrimaryModifier for keys; context Priority and Sink apply to buttons as to keys; a press that never gets its MouseButton1Up (the button is hidden or leaves the game) ends when the left mouse button comes up, or when the button leaves the game.
Verification
runtime::tests::input_actions_follow_ui_button_presses.cargo test --workspace --release --no-fail-fast: everything passes exceptrenderer_builds_on_opengl, which fails on this machine's session with "Parent device is lost" (no OpenGL device available; the render crate isn't touched here).--play-onlyin a place whose menu tabs are ImageButtons bound with UIButton: clicking a tab now switches it, and the same place works when played on a laptop.