Increment value Based on Input

When I press KeyCode.DownArrow I want to increment the private int 'idx' by one (each time), and when I press the KeyCode.UpArrow I want to decrement the same varaible by one (each time). For some reason when I try and increment it skips..Debug.Log(idx) shows 2,4,6,7.

private int idx = 0, amount = 0;
// Update is called once per frame
private void Update () {
    Debug.Log(idx);
}

private void InputAttributes() {
    if (Event.current.keyCode == KeyCode.DownArrow) {
        if (idx < 7) idx++;
        Debug.Log("Pressed Down");
    }
    if (Event.current.keyCode == KeyCode.UpArrow) {
        if (idx > 0) idx--;
        Debug.Log("Pressed Up");
    }
    if (Event.current.keyCode == KeyCode.LeftArrow) {
        amount--;
        Debug.Log("Pressed Left");
    }
    if (Event.current.keyCode == KeyCode.RightArrow) {
        amount++;
        Debug.Log("Pressed Right");
    }
}   
private void OnGUI() {
    if (Event.current.type == EventType.KeyDown) InputAttributes();
}

Use Update instead of OnGUI. OnGUI is called multiple times per frame.

If you really want to use OnGUI, check if Event.current.type == EventType.KeyDown and then check Event.current.keyCode == KeyCode.UpArrow, etc