/// <summary>
 /// Set the <see cref="InputBinding.name"/> of the binding.
 /// </summary>
 /// <param name="name">Name for the binding.</param>
 /// <returns>The same binding syntax for further configuration.</returns>
 /// <seealso cref="InputBinding.name"/>
 /// <seealso cref="AddBinding"/>
 public BindingSyntax WithName(string name)
 {
     m_ActionMap.m_Bindings[m_BindingIndex].name = name;
     m_ActionMap.ClearPerActionCachedBindingData();
     m_ActionMap.LazyResolveBindings();
     return(this);
 }
        private static int AddBindingInternal(InputActionMap map, InputBinding binding)
        {
            Debug.Assert(map != null);

            // Make sure the binding has an ID.
            if (string.IsNullOrEmpty(binding.m_Id))
            {
                binding.GenerateId();
            }

            // Append to bindings in set.
            var bindingIndex = ArrayHelpers.Append(ref map.m_Bindings, binding);

            // Invalidate per-action binding sets so that this gets refreshed if
            // anyone queries it.
            map.ClearPerActionCachedBindingData();

            // If we're looking at a singleton action, make sure m_Bindings is up to date just
            // in case the action gets serialized.
            if (map.m_SingletonAction != null)
            {
                map.m_SingletonAction.m_SingletonActionBindings = map.m_Bindings;
            }

            return(bindingIndex);
        }
            public BindingSyntax WithGroups(string groups)
            {
                if (string.IsNullOrEmpty(groups))
                {
                    return(this);
                }

                // Join with existing group, if any.
                var currentGroups = m_ActionMap.m_Bindings[m_BindingIndex].groups;

                if (!string.IsNullOrEmpty(currentGroups))
                {
                    groups = string.Join(InputBinding.kSeparatorString, currentGroups, groups);
                }

                // Set groups on binding.
                m_ActionMap.m_Bindings[m_BindingIndex].groups = groups;
                m_ActionMap.ClearPerActionCachedBindingData();

                return(this);
            }