private bool HandleKeyScan(ScanResult result)
    {
        //	When you return false you tell the InputManager that it should keep scaning for other keys
        if (!IsKeyValid(result.key))
            return false;

        //	The key is KeyCode.None when the timeout has been reached or the scan has been canceled
        if (result.key != KeyCode.None) {
            //	If the key is KeyCode.Backspace clear the current binding
            result.key = (result.key == KeyCode.Backspace) ? KeyCode.None : result.key;
            if (m_changePositiveKey) {
                if (m_changeAltKey)
                    m_axisConfig.altPositive = result.key;
                else
                    m_axisConfig.positive = result.key;
            }
            else {
                if (m_changeAltKey)
                    m_axisConfig.altNegative = result.key;
                else
                    m_axisConfig.negative = result.key;
            }
            m_keyDescription.text = (result.key == KeyCode.None) ? "" : result.key.ToString();
        }
        else {
            KeyCode currentKey = GetCurrentKeyCode();
            m_keyDescription.text = (currentKey == KeyCode.None) ? "" : currentKey.ToString();
        }

        m_image.overrideSprite = m_normalState;
        return true;
    }
    private bool HandleJoystickAxisScan(ScanResult result)
    {
        //	The axis is negative when the timeout has been reached or the scan has been canceled
        if (result.joystickAxis >= 0)
            m_axisConfig.SetAnalogAxis(m_joystick, result.joystickAxis);

        m_image.overrideSprite = m_normalState;
        m_keyDescription.text = m_axisNames[m_axisConfig.axis];
        return true;
    }
    private bool HandleJoystickButtonScan(ScanResult result)
    {
        if (result.scanFlags == ScanFlags.Key || result.scanFlags == ScanFlags.JoystickButton) {
            //	When you return false you tell the InputManager that it should keep scaning for other keys
            if (!IsJoytickButtonValid(result.key))
                return false;

            //	The key is KeyCode.None when the timeout has been reached or the scan has been canceled
            if (result.key != KeyCode.None) {
                //	If the key is KeyCode.Backspace clear the current binding
                result.key = (result.key == KeyCode.Backspace) ? KeyCode.None : result.key;
                m_axisConfig.type = InputType.Button;
                if (m_changePositiveKey) {
                    if (m_changeAltKey)
                        m_axisConfig.altPositive = result.key;
                    else
                        m_axisConfig.positive = result.key;
                }
                else {
                    if (m_changeAltKey)
                        m_axisConfig.altNegative = result.key;
                    else
                        m_axisConfig.negative = result.key;
                }
                m_keyDescription.text = (result.key == KeyCode.None) ? "" : result.key.ToString();
            }
            else {
                if (m_axisConfig.type == InputType.Button) {
                    KeyCode currentKey = GetCurrentKeyCode();
                    m_keyDescription.text = (currentKey == KeyCode.None) ? "" : currentKey.ToString();
                }
                else {
                    m_keyDescription.text = m_axisNames[m_axisConfig.axis];
                }
            }
            m_image.overrideSprite = m_normalState;
        }
        else {
            //	The axis is negative when the timeout has been reached or the scan has been canceled
            if (result.joystickAxis >= 0) {
                m_axisConfig.type = InputType.AnalogButton;
                m_axisConfig.SetAnalogButton(m_joystick, result.joystickAxis);
                m_keyDescription.text = m_axisNames[m_axisConfig.axis];
            }
            else {
                if (m_axisConfig.type == InputType.AnalogButton) {
                    m_keyDescription.text = m_axisNames[m_axisConfig.axis];
                }
                else {
                    KeyCode currentKey = GetCurrentKeyCode();
                    m_keyDescription.text = (currentKey == KeyCode.None) ? "" : currentKey.ToString();
                }
            }
            m_image.overrideSprite = m_normalState;
        }

        return true;
    }