// Restore all bindings to their default paths.
        public static void RemoveAllBindingOverrides(this InputAction action)
        {
            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }
            action.ThrowIfModifyingBindingsIsNotAllowed();

            var actionName = action.name;
            var actionMap  = action.GetOrCreateActionMap();
            var bindings   = actionMap.m_Bindings;

            if (bindings == null)
            {
                return;
            }

            var bindingCount = bindings.Length;

            for (var i = 0; i < bindingCount; ++i)
            {
                if (string.Compare(bindings[i].action, actionName, StringComparison.InvariantCultureIgnoreCase) != 0)
                {
                    continue;
                }

                bindings[i].overridePath         = null;
                bindings[i].overrideInteractions = null;
            }

            actionMap.LazyResolveBindings();
        }
        public static void RemoveBindingOverride(this InputAction action, InputBinding bindingOverride)
        {
            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }
            action.ThrowIfModifyingBindingsIsNotAllowed();

            bindingOverride.overridePath         = null;
            bindingOverride.overrideInteractions = null;

            // Simply apply but with a null binding.
            ApplyBindingOverride(action, bindingOverride);
        }
        /// <summary>
        /// Add a new binding to the action.
        /// </summary>
        /// <param name="action">A disabled action to add the binding to.</param>
        /// <param name="binding"></param>
        /// <returns>
        /// Returns a fluent-style syntax structure that allows performing additional modifications
        /// based on the new binding.
        /// </returns>
        /// <remarks>
        /// This works both with actions that are part of an action set as well as with actions that aren't.
        ///
        /// Note that actions must be disabled while altering their binding sets. Also, if the action belongs
        /// to a set, all actions in the set must be disabled.
        /// </remarks>
        public static BindingSyntax AddBinding(this InputAction action, InputBinding binding)
        {
            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }
            if (binding.path == null)
            {
                throw new ArgumentException("Binding path cannot be null", nameof(binding));
            }
            action.ThrowIfModifyingBindingsIsNotAllowed();

            ////REVIEW: should this reference actions by ID?
            Debug.Assert(action.m_Name != null || action.isSingletonAction);
            binding.action = action.name;

            var actionMap = action.GetOrCreateActionMap();

            actionMap.ThrowIfModifyingBindingsIsNotAllowed();
            var bindingIndex = AddBindingInternal(actionMap, binding);

            return(new BindingSyntax(actionMap, action, bindingIndex));
        }