Search Issue Tracker

Fixed in Unity 4.6.8

Votes

5

Found in

4.6.1f1

Issue ID

660196

Regression

No

Input.GetButtonDown returns true for as long as it is held

Linux

-

-

Priority: 5Not yet prioritized for a release

-

Severity: 3Secondary functionality broken

-e: On Linux, Input.GetButtonDown appears to return true every frame that the button is held, rather than once when it is first pushed. This does not happen on Windows (not checked osx yet) This is using a controller as an input device (two have been tested - a generic HID and an Xbox 360 controller). The input button used to test is the default "Submit" one. Keyboard button/s (Enter) that map to "Submit" do not show the behaviour.

-repro:
--build attached project for linux
--connect game pad and run project on linux
--press and hold the X button on the game pad
--NOTICE the counter updates every frame

Comments (5)

  1. 0c80f9470d69b80aaabcb1724ef150e1?d=mm

    DenisGLabrecque

    Dec 28, 2018 18:11

    I am experiencing a similar problem on Windows in Unity 2018.3.0f2

  2. E5f5bb986942194084491d5a71134847?d=mm

    KainAsylum

    Jul 14, 2015 05:28

    Confirmed that this is happening on Ubuntu with Unity 4.6.5f1

    I tested by placing this component on the camera of an empty scene in a fresh project

    [code]
    #if UNITY_EDITOR
    using UnityEditor;
    #endif //UNITY_EDITOR
    using UnityEngine;

    public class ButtonTest : MonoBehaviour
    {
    int m_downCount = 0;
    int m_holdCount = 0;
    int m_upCount = 0;
    bool m_isPressed = false;

    //////////////////////////////////////////////////////////////////////////////
    void Start()
    {
    m_downCount = 0;
    m_holdCount = 0;
    m_upCount = 0;
    m_isPressed = false;
    }

    //////////////////////////////////////////////////////////////////////////////
    void Update()
    {
    if (Input.GetButtonDown("Submit"))
    {
    ++m_downCount;
    }

    m_isPressed = Input.GetButton("Submit");
    if (m_isPressed)
    {
    ++m_holdCount;
    }

    if (Input.GetButtonUp("Submit"))
    {
    ++m_upCount;
    }

    if (Input.GetKeyDown(KeyCode.Escape))
    {
    #if UNITY_EDITOR
    //Application.Quit does not work in the editor
    EditorApplication.isPlaying = false;
    #else
    Application.Quit();
    #endif //UNITY_EDITOR
    }
    }

    //////////////////////////////////////////////////////////////////////////////
    void OnGUI()
    {
    string msg = "Button0 or Return Pressed: " + m_isPressed.ToString() + "\n";
    msg += "Down: " + m_downCount.ToString() + "\n";
    msg += "Hold: " + m_holdCount.ToString() + "\n";
    msg += "Up: " + m_upCount.ToString() + "\n";
    msg += "Esc to exit.\n";
    GUI.Label(new Rect(0, 0, Screen.width, Screen.height), msg);
    }
    }
    [/code]

  3. E5f5bb986942194084491d5a71134847?d=mm

    KainAsylum

    Jul 12, 2015 05:49

    This issue is preventing us from releasing confidently on the Linux Platform. We are on version 4.6 as well.

  4. 5bec0b7717ee45b4d287e4e51d30f5ef?d=mm

    ruj

    Jun 30, 2015 16:07

    We are seeing this issue in 4.6 as well, makes controllers unusable in Linux. Please fix ASAP

  5. 0ab4551de324fd9b77b29475c5cd0453?d=mm

    Andrew Tanoto

    Jan 06, 2015 14:38

    This affect UI Button, Button Script, On Click( ) on iOS devices.
    Player have to tap on the "Target Graphic" very fast to prevent the desired function from executing every frame, which takes up all the memory, thus making the button not executing at all.
    Works perfectly fine on computer, just not on iOS devices.

All about bugs

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