// Event Handlers

        // Called by the input field UI Button when pressed
        private void OnInputFieldClicked(int index, int actionElementMapToReplaceId)
        {
            if (index < 0 || index >= rows.Count)
            {
                return;                                  // index out of range
            }
            ControllerMap keyboardMap = player.controllers.maps.GetMap(ControllerType.Keyboard, 0, category, layout);
            ControllerMap mouseMap    = player.controllers.maps.GetMap(ControllerType.Mouse, 0, category, layout);

            // Cannot replace a keyboard binding on a Mouse Map or vice versa
            // Replacement cross device has to be done by removing the other
            // binding manually after input is mapped.
            // Determine which map the replacement binding exists on and store that information.
            ControllerMap controllerMapWithReplacement;

            // Determine if the replacement is on the keyboard or mouse map
            if (keyboardMap.ContainsElementMap(actionElementMapToReplaceId))
            {
                controllerMapWithReplacement = keyboardMap;
            }
            else if (mouseMap.ContainsElementMap(actionElementMapToReplaceId))
            {
                controllerMapWithReplacement = mouseMap;
            }
            else
            {
                controllerMapWithReplacement = null;  // not a replacement
            }
            // Store the information about the replacement if any
            _replaceTargetMapping = new TargetMapping()
            {
                actionElementMapId = actionElementMapToReplaceId,
                controllerMap      = controllerMapWithReplacement
            };

            // Begin listening for input on both keyboard and mouse at the same time

            inputMapper_keyboard.Start(
                new InputMapper.Context()
            {
                actionId                  = rows[index].action.id,
                controllerMap             = keyboardMap,
                actionRange               = rows[index].actionRange,
                actionElementMapToReplace = keyboardMap.GetElementMap(actionElementMapToReplaceId)
            }
                );

            inputMapper_mouse.Start(
                new InputMapper.Context()
            {
                actionId                  = rows[index].action.id,
                controllerMap             = mouseMap,
                actionRange               = rows[index].actionRange,
                actionElementMapToReplace = mouseMap.GetElementMap(actionElementMapToReplaceId)
            }
                );

            statusUIText.text = "Listening...";
        }
        // Event Handlers

        // Called by the input field UI Button when pressed
        private void OnInputFieldClicked(int index, int actionElementMapToReplaceId)
        {
            if (index < 0 || index >= rows.Count)
            {
                return;                                  // index out of range
            }
            ControllerMap keyboardMap = player.controllers.maps.GetMap(ControllerType.Keyboard, 0, category, layout);
            ControllerMap mouseMap    = player.controllers.maps.GetMap(ControllerType.Mouse, 0, category, layout);

            // Cannot replace a keyboard binding on a Mouse Map or vice versa
            // Replacement cross device has to be done by removing the other
            // binding manually after input is mapped.
            // Determine which map the replacement binding exists on and store that information.
            ControllerMap controllerMapWithReplacement;

            // Determine if the replacement is on the keyboard or mouse map
            if (keyboardMap.ContainsElementMap(actionElementMapToReplaceId))
            {
                controllerMapWithReplacement = keyboardMap;
            }
            else if (mouseMap.ContainsElementMap(actionElementMapToReplaceId))
            {
                controllerMapWithReplacement = mouseMap;
            }
            else
            {
                controllerMapWithReplacement = null;  // not a replacement
            }
            // Store the information about the replacement if any
            _replaceTargetMapping = new TargetMapping()
            {
                actionElementMapId = actionElementMapToReplaceId,
                controllerMap      = controllerMapWithReplacement
            };

            // Begin listening for input, but use a coroutine so it starts only after a short delay to prevent
            // the button bound to UI Submit from binding instantly when the input field is activated.
            StartCoroutine(StartListeningDelayed(index, keyboardMap, mouseMap, actionElementMapToReplaceId));
        }