Class InputControlSchemeNode
A control scheme, viewed through the underlying InputJSONNode.
Inherited Members
Namespace: Scylla.Input
Assembly: ScyllaInput.dll
Syntax
public sealed class InputControlSchemeNode
Remarks
Control schemes are the one element of this format that carries no GUID. They are identified by Name alone, and bindings associate with them through BindingGroup rather than by reference. A scheme rename is therefore a multi-target edit, and a rename made outside this tooling cannot be tracked.
Name and BindingGroup are usually equal but are not required to be, which is a recurring source of confusion when reading an asset.
Constructors
InputControlSchemeNode(InputJSONNode)
Wraps an existing control scheme node and builds wrappers for its device requirements.
Declaration
public InputControlSchemeNode(InputJSONNode node)
Parameters
| Type | Name | Description |
|---|---|---|
| InputJSONNode | node | The backing node. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when the node is |
Properties
BindingGroup
Gets or sets the binding group this scheme owns.
Declaration
public string BindingGroup { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Devices
Gets the device requirements, in document order.
Declaration
public IReadOnlyList<InputSchemeDeviceNode> Devices { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<InputSchemeDeviceNode> |
Name
Gets or sets the scheme 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
AddDevice(string, bool, bool)
Appends a device requirement.
Declaration
public InputSchemeDeviceNode AddDevice(string devicePath, bool isOptional = false, bool isOR = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | devicePath | Device layout path. |
| bool | isOptional | Whether the device is optional. |
| bool | isOR | Whether the requirement is OR-ed with the preceding one. |
Returns
| Type | Description |
|---|---|
| InputSchemeDeviceNode | The created requirement. |
Create(string, string)
Builds a new, empty control scheme node with its members in the order Unity emits them.
Declaration
public static InputControlSchemeNode Create(string name, string bindingGroup = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Scheme name. |
| string | bindingGroup | Binding group, or |
Returns
| Type | Description |
|---|---|
| InputControlSchemeNode | The wrapper around the new node. |
IndexOfDevice(InputSchemeDeviceNode)
Finds a device requirement's position in this scheme.
Declaration
public int IndexOfDevice(InputSchemeDeviceNode device)
Parameters
| Type | Name | Description |
|---|---|---|
| InputSchemeDeviceNode | device | The requirement to locate. |
Returns
| Type | Description |
|---|---|
| int | The zero-based position, or |
InsertDevice(int, string, bool, bool)
Creates a device requirement at a position.
Declaration
public InputSchemeDeviceNode InsertDevice(int index, string devicePath, bool isOptional, bool isOR)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | Where to insert, clamped into range. |
| string | devicePath | Device layout path, for example |
| bool | isOptional | Whether the device is optional. |
| bool | isOR | Whether the requirement is OR-ed with the preceding one. |
Returns
| Type | Description |
|---|---|
| InputSchemeDeviceNode | The created requirement. |
InsertDeviceNode(int, InputJSONNode)
Inserts an existing device requirement node at a position.
Declaration
public InputSchemeDeviceNode InsertDeviceNode(int index, InputJSONNode deviceNode)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | Where to insert, clamped into range. |
| InputJSONNode | deviceNode | The device node to adopt. |
Returns
| Type | Description |
|---|---|
| InputSchemeDeviceNode | The wrapper for the inserted node. |
Remarks
Order carries meaning here. A requirement marked as OR-ed combines with the one before it, so moving a requirement past an OR-ed neighbour changes which devices satisfy the scheme.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when the node is |
RefreshNodeCache()
Rebuilds this scheme's device wrappers from its JSON.
Declaration
public void RefreshNodeCache()
Remarks
Needed after editing the device array through Node directly. Every existing wrapper is discarded, so a caller holding one across this call is holding an orphan.
RemoveDevice(InputSchemeDeviceNode)
Removes a device requirement.
Declaration
public bool RemoveDevice(InputSchemeDeviceNode device)
Parameters
| Type | Name | Description |
|---|---|---|
| InputSchemeDeviceNode | device | The requirement to remove. |
Returns
| Type | Description |
|---|---|
| bool |
|
RemoveDeviceAt(int)
Removes the device requirement at a position.
Declaration
public bool RemoveDeviceAt(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The position to remove. |
Returns
| Type | Description |
|---|---|
| bool |
|