Game.Input.ProxyComposite
Assembly: Game
Namespace: Game.Input
Type: class
Base: System.Object
Summary:
ProxyComposite is a runtime proxy/wrapper for a CompositeInstance (an input composite definition) bound to a specific input device and action type. It maps individual ActionComponent entries to ProxyBinding objects, exposes metadata (built-in, rebindable, usages, etc.) from the underlying CompositeInstance, and tracks links to ProxyAction instances that use this composite. This class is used by the input system to represent composite bindings in a device- and action-aware form suitable for querying, rebind handling, and editor/UX code in mods.
Fields
public struct Info
This nested struct packages a composite's device, source CompositeInstance, and a list of ProxyBinding objects. Useful for passing lightweight descriptions of a ProxyComposite where a full ProxyComposite instance is not required.public InputManager.DeviceType m_Device
— device this info refers to.public CompositeInstance m_Source
— source composite definition.-
public List<ProxyBinding> m_Bindings
— collection of bindings for the composite. -
private readonly CompositeInstance m_Source
Holds the original CompositeInstance that this ProxyComposite wraps. Many read-only properties delegate to fields on this source (e.g., builtIn, isDummy, rebindable flags, usages). -
public readonly InputManager.DeviceType m_Device
Device this proxy composite applies to (e.g., Keyboard, Gamepad). Set at construction and read-only afterwards. -
public readonly ActionType m_Type
Type of action this composite is associated with (e.g., Button, Axis). Set at construction. -
internal readonly HashSet<ProxyAction> m_LinkedActions = new HashSet<ProxyAction>()
Set of ProxyAction objects that reference / are linked to this composite. Used internally by the input system to find which actions will be affected by changes to this composite. -
private readonly Dictionary<ActionComponent, ProxyBinding> m_Bindings = new Dictionary<ActionComponent, ProxyBinding>()
Internal mapping from ActionComponent (component identifier within the composite) to the corresponding ProxyBinding instance.
Properties
-
public IReadOnlyDictionary<ActionComponent, ProxyBinding> bindings => m_Bindings
Read-only view of the bindings map. Use this to enumerate component→binding relationships for the composite. -
public bool isSet => m_Bindings.Any((KeyValuePair<ActionComponent, ProxyBinding> b) => b.Value.isSet)
True when at least one component binding in this composite has a set binding (i.e., has an assigned key/button/etc.). Shortcut used to determine whether the composite is effectively configured. -
public bool isBuiltIn => m_Source.builtIn
Delegates to CompositeInstance.builtIn — whether this composite is a built-in (non-user) composite. -
internal bool isDummy => m_Source.isDummy
Delegates to CompositeInstance.isDummy — whether this composite is a dummy placeholder. -
internal bool isHidden => m_Source.isHidden
Delegates to CompositeInstance.isHidden — whether this composite should be hidden in UI. -
public bool isRebindable => m_Source.isRebindable
Whether the composite (its bindings) can be rebound by the user. -
public bool isModifiersRebindable => m_Source.isModifiersRebindable
Whether modifier components inside this composite can be rebound independently. -
public bool allowModifiers => m_Source.allowModifiers
Whether this composite allows modifier components. -
public bool canBeEmpty => m_Source.canBeEmpty
Whether the composite is allowed to have no bindings (i.e., be empty). -
public bool developerOnly => m_Source.developerOnly
Whether the composite is intended only for developer use (hidden for regular users). -
public Usages usage => m_Source.usages
Usage flags/metadata carried from the CompositeInstance describing contexts where the composite is relevant.
Constructors
internal ProxyComposite(InputManager.DeviceType device, ActionType type, CompositeInstance source, IList<ProxyBinding> bindings)
Creates a ProxyComposite for the given device and action type wrapping the provided CompositeInstance. All supplied ProxyBinding entries are inserted into the internal bindings dictionary keyed by their ActionComponent. Internal constructor: intended to be created by the input system / factory code rather than user mods directly.
Methods
-
public bool TryGetBinding(ProxyBinding sampleBinding, out ProxyBinding foundBinding)
Tries to find a binding by using the sampleBinding.component as the lookup key. Returns true and sets foundBinding if present. -
public bool TryGetBinding(ActionComponent component, out ProxyBinding foundBinding)
Tries to find a binding for the given ActionComponent. Returns true and sets foundBinding if present. -
public override string ToString()
Returns a short textual representation in the form "{m_Device} ({m_Type})", useful for logging and debugging.
Usage Example
// Example usage within the same assembly (constructor is internal)
CompositeInstance compositeInstance = /* obtain CompositeInstance from input system */;
IList<ProxyBinding> proxyBindings = /* build or obtain ProxyBinding list for each component */;
var proxy = new ProxyComposite(InputManager.DeviceType.Keyboard, ActionType.Button, compositeInstance, proxyBindings);
// Query whether any binding is set
if (proxy.isSet)
{
// Enumerate bindings
foreach (var kv in proxy.bindings)
{
ActionComponent component = kv.Key;
ProxyBinding binding = kv.Value;
// Inspect binding (e.g., binding.isSet, binding.path, etc.)
}
}
// Try to get a specific component binding
if (proxy.TryGetBinding(ActionComponent.Primary, out ProxyBinding primaryBinding))
{
// Work with primaryBinding
}
// Debug string
Debug.Log(proxy.ToString()); // e.g. "Keyboard (Button)"
{{ Notes for modders: ProxyComposite is constructed internally by the input management/factory code. If you need to create or modify ProxyComposite instances in a mod, prefer interacting with the InputManager / provided API to obtain or request changes rather than instantiating this type directly. Use the properties to reflect CompositeInstance metadata and to drive UI or rebind flows. }}