public static void SetToDefault <TEnum>(
                InputActionContainer <TEnum> actions,
                InputActionContainer <TEnum> defaultActions,
                int categoryMask,
                IInputDevice device
                ) where TEnum : System.Enum
            {
                foreach (TEnum actionEnum in EnumX <TEnum> .Values)
                {
                    InputAction action = actions.GetActionConfig(actionEnum);

                    if (((1 << actions.GetActionConfig(actionEnum).properties.category) & categoryMask) == 0)
                    {
                        continue;
                    }

                    InputAction defaultAction = defaultActions.GetActionConfig(actionEnum);
                    action.RemoveMapsForDevice(device);

                    var defaultMaps = defaultAction.GetMapsForDevice(device);
                    foreach (var map in defaultMaps)
                    {
                        action.Add(map.Clone());
                    }
                }
            }
        public void SetupFromAction(InputAction inputAction, IEnumerable <InputAction> allActions, IInputDevice device, ButtonClickCallback callbackFn, bool disablePropertyRestrictions)
        {
            // populate strings and callback fns
            actionNameText.text = inputAction.properties.displayName;

            var maps = inputAction.GetMapsForDevice(device);

            if (maps != null && maps.Count > 0)
            {
                for (int i = 0; i < actionInputButtons.Length; ++i)
                {
                    IInputMap map;
                    if (i >= maps.Count)
                    {
                        var clone = maps[0].Clone();
                        clone.SetEmpty();
                        inputAction.Add(clone);
                        map = clone;
                    }
                    else
                    {
                        map = maps[i];
                    }

                    var button     = actionInputButtons[i];
                    var buttonText = button.GetComponentInChildren <Text>();

                    Debug.Assert(buttonText);
                    Debug.Assert(map != null);

                    if (map != null && !map.IsEmpty)
                    {
                        buttonText.text = map.GetInputStr();
                    }
                    else
                    {
                        buttonText.text = kNoInputStr;
                    }

                    button.interactable = inputAction.properties.rebindable || disablePropertyRestrictions;
                    button.onClick.RemoveAllListeners();
                    button.onClick.AddListener(delegate { callbackFn(map, inputAction, allActions, device); });
                }
            }
            else
            {
                Debug.LogError("Unable to find input maps for device " + device);
            }
        }