Struct InputActionSetupExtensions.ControlSchemeSyntax
Write accessor to a control scheme.
Namespace: UnityEngine.InputSystem
Syntax
public struct ControlSchemeSyntax
Methods
Done()
Call this method when done building out the control scheme to return the associated instance.
Declaration
public InputControlScheme Done()
Returns
Type | Description |
---|---|
InputControlScheme | The associated control scheme |
OrWithOptionalDevice(String)
Adds another possible optional device to control scheme.
Declaration
public InputActionSetupExtensions.ControlSchemeSyntax OrWithOptionalDevice(string controlPath)
Parameters
Type | Name | Description |
---|---|---|
String | controlPath | Device path, like <Gamepad>. |
Returns
Type | Description |
---|---|
InputActionSetupExtensions.ControlSchemeSyntax | The same control scheme syntax for further configuration. |
OrWithOptionalDevice<TDevice>()
Combines another optional device with the previous device using boolean OR logic such that either the previous device or this device are required to be present. If this is the last device in a chain of OR'd devices, the entire chain of devices becomes optional.
Declaration
public InputActionSetupExtensions.ControlSchemeSyntax OrWithOptionalDevice<TDevice>()
where TDevice : InputDevice
Returns
Type | Description |
---|---|
InputActionSetupExtensions.ControlSchemeSyntax | The same control scheme syntax for further configuration. |
Type Parameters
Name | Description |
---|---|
TDevice | Type of device. |
OrWithRequiredDevice(String)
Adds another possible required device to the control scheme.
Declaration
public InputActionSetupExtensions.ControlSchemeSyntax OrWithRequiredDevice(string controlPath)
Parameters
Type | Name | Description |
---|---|---|
String | controlPath | Device path, like <Gamepad>. |
Returns
Type | Description |
---|---|
InputActionSetupExtensions.ControlSchemeSyntax | The same control scheme syntax for further configuration. |
OrWithRequiredDevice<TDevice>()
Combines another required device with the previous device using boolean OR logic such that either the previous device or this device are required to be present.
Declaration
public InputActionSetupExtensions.ControlSchemeSyntax OrWithRequiredDevice<TDevice>()
where TDevice : InputDevice
Returns
Type | Description |
---|---|
InputActionSetupExtensions.ControlSchemeSyntax | The same control scheme syntax for further configuration. |
Type Parameters
Name | Description |
---|---|
TDevice | Type of device. |
Remarks
// Create an .inputactions asset.
var asset = ScriptableObject.CreateInstance<InputActionAsset>();
asset.AddControlScheme("KeyboardAndMouseOrPen")
.WithRequiredDevice("<Keyboard>")
.WithRequiredDevice("<Mouse>")
.OrWithRequiredDevice("<Pen>")
WithBindingGroup(String)
Sets or overwrite the binding group for control scheme.
Declaration
public InputActionSetupExtensions.ControlSchemeSyntax WithBindingGroup(string bindingGroup)
Parameters
Type | Name | Description |
---|---|---|
String | bindingGroup | A binding group. See groups. |
Returns
Type | Description |
---|---|
InputActionSetupExtensions.ControlSchemeSyntax | The same control scheme syntax for further configuration. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If provided name is null or empty. |
WithOptionalDevice(String)
Add an optional device to the control scheme.
Declaration
public InputActionSetupExtensions.ControlSchemeSyntax WithOptionalDevice(string controlPath)
Parameters
Type | Name | Description |
---|---|---|
String | controlPath | The device path, like <Gamepad>. |
Returns
Type | Description |
---|---|
InputActionSetupExtensions.ControlSchemeSyntax | The same control scheme syntax for further configuration. |
WithOptionalDevice<TDevice>()
Adds an optional device to control scheme.
Declaration
public InputActionSetupExtensions.ControlSchemeSyntax WithOptionalDevice<TDevice>()
where TDevice : InputDevice
Returns
Type | Description |
---|---|
InputActionSetupExtensions.ControlSchemeSyntax | The same control scheme syntax for further configuration. |
Type Parameters
Name | Description |
---|---|
TDevice | Type of device. |
WithRequiredDevice(String)
Adds a required device to control scheme.
Declaration
public InputActionSetupExtensions.ControlSchemeSyntax WithRequiredDevice(string controlPath)
Parameters
Type | Name | Description |
---|---|---|
String | controlPath | Device path, like <Gamepad>. |
Returns
Type | Description |
---|---|
InputActionSetupExtensions.ControlSchemeSyntax | The same control scheme syntax for further configuration. |
WithRequiredDevice<TDevice>()
Adds a required device to control scheme.
Declaration
public InputActionSetupExtensions.ControlSchemeSyntax WithRequiredDevice<TDevice>()
where TDevice : InputDevice
Returns
Type | Description |
---|---|
InputActionSetupExtensions.ControlSchemeSyntax | The same control scheme syntax for further configuration. |
Type Parameters
Name | Description |
---|---|
TDevice | Type of device. |