Class InputContextDefinition
A serializable data object that describes the settings for an InputContext, authored in the Unity Inspector via ScyllaInputContextConfiguration. At runtime, call CreateContext() to convert this definition into a live InputContext that can be registered and pushed onto the context stack.
Inherited Members
Namespace: Scylla.Input
Assembly: ScyllaInput.dll
Syntax
[Serializable]
public class InputContextDefinition
Remarks
This class intentionally mirrors every settable property of InputContext so that all context configuration can be done in the Inspector without writing code. It also supports being created programmatically and passed directly to RegisterContext(InputContext) after calling CreateContext().
Call Validate(int) before registration during authoring to detect empty IDs, duplicate action map names, and duplicate tags.
Action map names are compared case-insensitively during duplicate detection (in
Validate(int)) but are stored and passed to InputContext as-is.
Make sure the names match the exact casing used in the InputActionAsset.
Fields
BlocksLowerPriority
When true, this context prevents all contexts with a strictly lower
Priority from receiving input while this context is above them on the
stack. Corresponds to BlocksLowerPriority.
Declaration
[Tooltip("When enabled, all input contexts with a lower priority value than this one are prevented from receiving input while this context is active.")]
public bool BlocksLowerPriority
Field Value
| Type | Description |
|---|---|
| bool |
ConflictExclusiveTags
Optional tags marking mutual exclusivity. Contexts that share at least one tag are understood to never be active simultaneously (for example on-foot gameplay, driving, and flying, which are three ways to occupy one slot). Conflict detection uses this to skip false-positive binding conflicts between action maps the player can never have live together.
Declaration
[Tooltip("Optional tags marking mutual exclusivity. Contexts sharing at least one tag are never active simultaneously, so their bindings are not checked against each other for conflicts. Independent of priority and the blocking flags.")]
public List<string> ConflictExclusiveTags
Field Value
| Type | Description |
|---|---|
| List<string> |
Remarks
An empty list means the context participates in no exclusive set, and its bindings are always checked for conflicts against every other context. That is the conservative default: an unauthored context over-reports rather than hides.
A tag is a plain string with no imposed naming convention, compared
case-insensitively and never interpreted by the module. Example values:
"Movement", "CameraMode", "VehicleType". A context may carry
several tags when it belongs to more than one exclusive set.
Tags decide conflict reporting and nothing else. They are independent of Priority, BlocksLowerPriority and ConsumesAllInput: a context that blocks everything beneath it is still not exclusive with anything until a tag says so. See InputContextExclusivity for the full rule.
ConsumesAllInput
When true, this context prevents every context below it on the stack from
receiving input regardless of their priority values. This is a stronger mode than
BlocksLowerPriority, which it subsumes. Setting both is harmless and is not
reported as a problem.
Corresponds to ConsumesAllInput.
Declaration
[Tooltip("When enabled, this context consumes all input and blocks every context below it regardless of individual blocking settings. Subsumes Blocks Lower Priority; setting both is harmless.")]
public bool ConsumesAllInput
Field Value
| Type | Description |
|---|---|
| bool |
ContextID
Unique string identifier for the context produced by CreateContext(). This value is passed as ContextID and used in all push/pop/query operations. Must be unique across all registered contexts. Empty string will fail Validate(int) and will be skipped during Apply().
Declaration
[Tooltip("Unique string identifier for this input context. Referenced in PushContext and PopContext calls to activate or deactivate the context at runtime.")]
public string ContextID
Field Value
| Type | Description |
|---|---|
| string |
Description
Optional free-text description explaining when this context should be active and what gameplay state it represents. Not used at runtime; intended for authoring clarity.
Declaration
[Tooltip("Optional description explaining the purpose of this context and the gameplay situations in which it should be active.")]
public string Description
Field Value
| Type | Description |
|---|---|
| string |
DisabledActionMaps
Names of the Unity Input System action maps to disable when this context becomes the
top context. Applied before EnabledActionMaps. Names must match those
in the project's InputActionAsset exactly. Null and empty entries are skipped
by CreateContext().
Declaration
[Tooltip("List of InputActionAsset action map names that are automatically disabled when this context becomes active.")]
public List<string> DisabledActionMaps
Field Value
| Type | Description |
|---|---|
| List<string> |
DisplayName
Human-readable label for the context, shown in debug overlays and log messages. When empty, CreateContext() substitutes ContextID for the DisplayName so the label is never blank.
Declaration
[Tooltip("Human-readable name displayed in debug tools, logs, and the inspector for easier identification.")]
public string DisplayName
Field Value
| Type | Description |
|---|---|
| string |
EnabledActionMaps
Names of the Unity Input System action maps to enable when this context becomes the
top context. Names must match those in the project's InputActionAsset exactly.
Null and empty entries are skipped by CreateContext().
Duplicate entries and entries that also appear in DisabledActionMaps
will be reported as errors by Validate(int).
Declaration
[Tooltip("List of InputActionAsset action map names that are automatically enabled when this context becomes active.")]
public List<string> EnabledActionMaps
Field Value
| Type | Description |
|---|---|
| List<string> |
PRIORITY_MAXIMUM
Highest priority a context may be given.
Declaration
public const int PRIORITY_MAXIMUM = 100
Field Value
| Type | Description |
|---|---|
| int |
PRIORITY_MINIMUM
Lowest priority a context may be given.
Declaration
public const int PRIORITY_MINIMUM = -100
Field Value
| Type | Description |
|---|---|
| int |
Remarks
Named rather than written twice. The bound is enforced by the Inspector's slider and by the editor command that writes the field, and an editor that clamped to a different number from the one the slider offers would be worse than no bound.
Priority
Integer priority assigned to the Priority property.
Higher values indicate higher priority. When BlocksLowerPriority is
true, this context will block any context on the stack with a strictly lower
priority value. Valid range enforced in the Inspector: -100 to 100.
Declaration
[Tooltip("Numeric priority level that determines blocking order. Contexts with higher priority values can block input from reaching lower-priority contexts.")]
[Range(-100, 100)]
public int Priority
Field Value
| Type | Description |
|---|---|
| int |
Methods
CreateContext()
Constructs and returns a new InputContext populated with all settings from this definition. The returned context has not been registered with or pushed onto the IInputContextManager; pass it to RegisterContext(InputContext) or PushContext(InputContext) to activate it.
Declaration
public InputContext CreateContext()
Returns
| Type | Description |
|---|---|
| InputContext | A new InputContext whose properties mirror this definition's fields. When DisplayName is null or empty, ContextID is used as the display name. Null and empty entries in EnabledActionMaps and DisabledActionMaps are skipped. |
Validate(int)
Validates the fields of this definition and returns a list of diagnostic messages. Checks performed:
- Empty ContextID - Error.
- Empty or whitespace-only entries in ConflictExclusiveTags - Warning; duplicate tags - Error.
- Empty or duplicate entries in EnabledActionMaps - Warning for empty, Error for duplicate.
- Empty or duplicate entries in DisabledActionMaps - Warning for empty, Error for duplicate.
- Action map names that appear in both EnabledActionMaps and DisabledActionMaps - Error.
Duplicate detection is case-insensitive. Does not modify any field values.
Declaration
public List<ContextValidationMessage> Validate(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The zero-based index of this definition in its containing list, used to construct human-readable error messages such as "Context at index 2 has empty Context ID." |
Returns
| Type | Description |
|---|---|
| List<ContextValidationMessage> | A list of ContextValidationMessage entries. An empty list means the definition passed all checks. |