// Update is called once per frame
    void Update()
    {
        if (colorChosen)
        {
            return;
        }
        float inputValue = Input.GetAxis(axisName);

        if (inputValue != 0f)
        {
            if (pressed)
            {
                return;
            }
            pressed = true;
            if (inputValue > 0f)
            {
                try {
                    index++;
                    colorImage.color = colors[colorNames[index]];
                } catch (KeyNotFoundException) {
                    index            = 0;
                    colorImage.color = colors[colorNames[index]];
                }
            }
            else
            {
                try {
                    index--;
                    colorImage.color = colors[colorNames[index]];
                } catch (KeyNotFoundException) {
                    index            = colorsToChoose.Length - 1;
                    colorImage.color = colors[colorNames[index]];
                }
            }
            inputValue = 0f;
            return;
        }
        else
        {
            pressed = false;
        }

        bool buttonPressed = Input.GetKeyDown($"joystick {id} button 0");

        if (buttonPressed)
        {
            Debug.Log("Pressed A: " + buttonPressed.ToString());
            Debug.Log($"{colorPicker.mappedColours.Count}");
            foreach (var entry in colorPicker.mappedColours)
            {
                Debug.Log($"id: {entry.Key}, Color: {entry.Value.ToString()}");
            }
            try {
                colorPicker.Add(id, colorNames[index]);
                colorChosen = true;
                Debug.Log($"color chosen for player nr {id}. value: {colorsToChoose[index]}");
            }
            catch (System.IndexOutOfRangeException) {
                return;
            }
            catch (System.ArgumentException) {
                //handle choosing other color
                Debug.Log("Color is already chosen!");
            }
        }
        pressed = false;
    }