Search Issue Tracker
Won't Fix
Votes
1
Found in
5.3.5f1
Issue ID
822405
Regression
No
GetButtonDown() keeps getting triggered when a button is held and scene is being loaded
Steps to reproduce:
1. Open attached project "repro_project.zip"
2. Open "0" scene
3. Press Play
4. Press and hold "E" key
(there's two scenes which both load each other when Input.GetButtonDown() is triggered)
5. Notice that if you hold "E" key scenes keep loading one another (gif attached)
Expected behavior: according to documentation GetButtonDown() is triggered the frame when user presses the key, so GetButtonDown() should not get automatically triggered when loading a new scene
Reproduced with: 5.3.6p2, 5.4.0p1, 5.5.0a5
Comments (3)
-
laurencenairne
Apr 07, 2017 14:37
For anyone struggling with this, my workaround was to use another script to disable the component that managed UI fade in (but can be used on any component you wish) on awake, and start a coroutine that waits for a second, then enables the component again.
This way any lingering GetButtonDown is ignored in the first frames.
-
laurencenairne
Apr 07, 2017 13:34
I should add that I've experienced this in v5.5.3f1
-
laurencenairne
Apr 07, 2017 13:27
I've experienced this as well, though I'm using Input.GetMouseButtonDown(0) in a script to reveal a world space UI panel. Kind of weird as it doesn't do it the first time I open the scene from the main menu, but all subsequent times it will load the scene with the UI open.
I have a Debug.Log within my IF statement that would only trigger if Input.GetMouseButtonDown(0) is registered so it's definitely taking my input from the previous scene.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- “Default Scene” dropdown field contains a spelling mistake “Default Builtin”
- Editor crashes on PPtr<Mesh> after adding Text Mesh and Cloth Components to the same GameObject
- Previously deleted “DefaultLookDevProfile“ is present when upgrading the Editor version
- [Ubuntu] UI text and buttons are missing spaces in Unity Version Control > New Workspace window
- "Inherit attribute is not supported" warning is shown but attributes are available in VFX Graph Output and Update blocks
Resolution Note:
We are deprecating the current input system and replacing it with a new one. We have logged these bugs in the new input system Github page.
You can download the new input system here: https://github.com/Unity-Technologies/InputSystem