Class InputActionMapNode
An action map, viewed through the underlying InputJSONNode.
Inherited Members
Namespace: Scylla.Input
Assembly: ScyllaInput.dll
Syntax
public sealed class InputActionMapNode
Constructors
InputActionMapNode(InputJSONNode)
Wraps an existing map node and builds wrappers for its actions and bindings.
Declaration
public InputActionMapNode(InputJSONNode node)
Parameters
| Type | Name | Description |
|---|---|---|
| InputJSONNode | node | The backing node. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when the node is |
Properties
Actions
Gets the actions in this map, in document order.
Declaration
public IReadOnlyList<InputActionNode> Actions { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<InputActionNode> |
Bindings
Gets the bindings in this map, in document order.
Declaration
public IReadOnlyList<InputBindingNode> Bindings { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<InputBindingNode> |
ID
Gets or sets the stable GUID.
Declaration
public string ID { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Name
Gets or sets the map name.
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Node
Gets the backing node, for access to members this wrapper does not model.
Declaration
public InputJSONNode Node { get; }
Property Value
| Type | Description |
|---|---|
| InputJSONNode |
Methods
AddAction(string, string, string, string)
Appends a new action to this map.
Declaration
public InputActionNode AddAction(string name, string actionID, string actionType = "Button", string expectedControlType = "")
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Action name, unique within this map. |
| string | actionID | Stable GUID. |
| string | actionType | Action type: |
| string | expectedControlType | Expected control layout, or empty. |
Returns
| Type | Description |
|---|---|
| InputActionNode | The new action. |
AddBinding(string, string, string, string)
Appends a new binding to this map.
Declaration
public InputBindingNode AddBinding(string name, string bindingID, string path, string actionName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Binding name, or the part name for a composite part. |
| string | bindingID | Stable GUID. |
| string | path | Control path, or the composite type name for a composite head. |
| string | actionName | Owning action name. |
Returns
| Type | Description |
|---|---|
| InputBindingNode | The new binding. |
Remarks
Bindings live on the map rather than on the action, and name their action rather than referencing it by GUID, which is why the owning action is passed as a string.
Create(string, string)
Builds a new, empty map node with its members in the order Unity emits them.
Declaration
public static InputActionMapNode Create(string name, string id)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Map name. |
| string | id | Stable GUID. |
Returns
| Type | Description |
|---|---|
| InputActionMapNode | The wrapper around the new node. |
FindAction(string)
Finds an action by name.
Declaration
public InputActionNode FindAction(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The action name, compared ordinally and case-insensitively, matching how the rest of the module compares action names. |
Returns
| Type | Description |
|---|---|
| InputActionNode | The action, or |
GetBindingsForAction(string, List<InputBindingNode>)
Gathers the bindings belonging to one action.
Declaration
public int GetBindingsForAction(string actionName, List<InputBindingNode> results)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actionName | The action name, compared ordinally and case-insensitively. |
| List<InputBindingNode> | results | The list to append to. Not cleared by this method. |
Returns
| Type | Description |
|---|---|
| int | The number of bindings appended. |
Remarks
Bindings name their action rather than referencing it by GUID, so this is a name match. Order is preserved, which matters because a composite head is followed by its parts and the sequence carries meaning.
IndexOfAction(InputActionNode)
Finds an action's position in this map.
Declaration
public int IndexOfAction(InputActionNode action)
Parameters
| Type | Name | Description |
|---|---|---|
| InputActionNode | action | The action to locate. |
Returns
| Type | Description |
|---|---|
| int | The zero-based position, or |
IndexOfBinding(InputBindingNode)
Finds a binding's position in this map, in raw document order.
Declaration
public int IndexOfBinding(InputBindingNode binding)
Parameters
| Type | Name | Description |
|---|---|---|
| InputBindingNode | binding | The binding to locate. |
Returns
| Type | Description |
|---|---|
| int | The zero-based position, or |
Remarks
Raw order, not the order within an action. Composite parts follow their head in the map's array and structural editing has to work in those terms.
InsertAction(int, string, string, string, string)
Creates an action at a position.
Declaration
public InputActionNode InsertAction(int index, string name, string actionID, string actionType = "Button", string expectedControlType = "")
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | Where to insert, clamped into range. |
| string | name | The action name. |
| string | actionID | The action's GUID. |
| string | actionType | Button, Value or PassThrough. |
| string | expectedControlType | The expected control type, or empty. |
Returns
| Type | Description |
|---|---|
| InputActionNode | The created action. |
InsertActionNode(int, InputJSONNode)
Inserts an existing action node at a position.
Declaration
public InputActionNode InsertActionNode(int index, InputJSONNode actionNode)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | Where to insert, clamped into range. |
| InputJSONNode | actionNode | The action node to adopt. |
Returns
| Type | Description |
|---|---|
| InputActionNode | The wrapper for the inserted node. |
Remarks
Takes a raw node rather than field values, because duplicate and paste must carry a subtree across verbatim. Rebuilding it from known fields would silently drop anything this layer does not model, which is precisely what the document layer exists to preserve.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when the node is |
InsertBinding(int, string, string, string, string)
Creates a binding at a position in raw document order.
Declaration
public InputBindingNode InsertBinding(int index, string name, string bindingID, string path, string actionName)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | Where to insert, clamped into range. |
| string | name | The part name, or empty for a plain binding. |
| string | bindingID | The binding's GUID. |
| string | path | The control path, or the composite type for a head. |
| string | actionName | The owning action's name. |
Returns
| Type | Description |
|---|---|
| InputBindingNode | The created binding. |
InsertBindingNode(int, InputJSONNode)
Inserts an existing binding node at a position in raw document order.
Declaration
public InputBindingNode InsertBindingNode(int index, InputJSONNode bindingNode)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | Where to insert, clamped into range. |
| InputJSONNode | bindingNode | The binding node to adopt. |
Returns
| Type | Description |
|---|---|
| InputBindingNode | The wrapper for the inserted node. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when the node is |
RefreshNodeCache()
Rebuilds this map's action and binding wrappers from its JSON.
Declaration
public void RefreshNodeCache()
Remarks
Needed after editing the map's arrays through Node directly, which leaves the cached wrapper lists describing a document that no longer exists. The alternative was RebuildNodeCache(), which replaces every wrapper in the whole document and so invalidates references a caller may still be holding elsewhere.
Every existing wrapper for this map's children is discarded, so a caller holding one across this call is holding an orphan. Re-resolve by identifier afterwards.
RemoveAction(InputActionNode)
Removes an action. Its bindings are left alone; the caller decides whether they should go too, because a rename-and-reattach flow wants to keep them.
Declaration
public bool RemoveAction(InputActionNode action)
Parameters
| Type | Name | Description |
|---|---|---|
| InputActionNode | action | The action to remove. |
Returns
| Type | Description |
|---|---|
| bool |
|
RemoveActionAt(int)
Removes the action at a position, leaving its bindings alone.
Declaration
public bool RemoveActionAt(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The position to remove. |
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
Matches RemoveAction(InputActionNode) in leaving the bindings behind. A caller that wants Unity's delete semantics removes the bindings itself first.
RemoveBinding(InputBindingNode)
Removes a binding.
Declaration
public bool RemoveBinding(InputBindingNode binding)
Parameters
| Type | Name | Description |
|---|---|---|
| InputBindingNode | binding | The binding to remove. |
Returns
| Type | Description |
|---|---|
| bool |
|
RemoveBindingAt(int)
Removes the binding at a position in raw document order.
Declaration
public bool RemoveBindingAt(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The position to remove. |
Returns
| Type | Description |
|---|---|
| bool |
|