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

Input

-

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

  1. 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

Comments (3)

  1. 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.

  2. laurencenairne

    Apr 07, 2017 13:34

    I should add that I've experienced this in v5.5.3f1

  3. 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

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.