Class ScyllaInputContextConfiguration
ScriptableObject configuration asset that holds a list of InputContextDefinition
objects. Each definition is converted to an InputContext and registered
with the IInputContextManager automatically when the Scylla Input module
initializes. Create an instance via
Assets → Create → Scylla → Input → Context Configuration.
Inherited Members
Namespace: Scylla.Input
Assembly: ScyllaInput.dll
Syntax
[CreateAssetMenu(fileName = "Scylla Input Context Configuration", menuName = "Scylla/Input/Context Configuration")]
public sealed class ScyllaInputContextConfiguration : ScyllaConfiguration
Remarks
Contexts define which action maps are active at a given moment and whether higher-priority contexts block input from lower-priority ones. The six default contexts produced by CreateDefaultContextDefinitions() are:
- Gameplay (priority 0, tagged "Mode") - active during normal gameplay.
- Gameplay - Debug (priority 50) - gameplay with the debug actions available as well.
- Menu (priority 80) - active when a menu is open; blocks gameplay input.
- Console (priority 90) - active when the debug console is open; blocks lower-priority contexts.
- Global (priority 95) - always active; handles screenshot/debug toggle actions without blocking others. Sits below Rebinding so an interactive rebind outranks it.
- Rebinding (priority 100) - active only during an interactive rebind; consumes every input so the pressed key reaches the rebind and nothing else.
Contexts can also be registered programmatically at any time via RegisterContext(InputContext) without any asset. The asset merely provides a convenient authoring surface and ensures contexts are available as soon as the module finishes initializing.
The context list can be overridden at runtime from a JSON config file via ApplyConfigFileOverrides(ConfigFile). When an override list is present the entire ContextDefinitions list is replaced - partial overrides are not supported. Action map name arrays are stored as arrays of individual string properties to avoid delimiter conflicts with map names that contain commas.
Fields
CONFIG_FILENAME
File name used to locate this asset in the Resources folder for auto-loading.
Also used as the default asset name when creating a new instance via the
Create Asset menu.
Declaration
public const string CONFIG_FILENAME = "Scylla Input Context Configuration"
Field Value
| Type | Description |
|---|---|
| string |
DEFAULT_CONTEXTS_PATH
Resources path of the context configuration the framework ships, used as the last fallback when a project has assigned no asset and created none of its own.
Declaration
public const string DEFAULT_CONTEXTS_PATH = "Input Contexts/Scylla Input Contexts - Default"
Field Value
| Type | Description |
|---|---|
| string |
Remarks
This is not CONFIG_FILENAME under the standard config folder. That key belongs to the project: it is where the Input Wizard writes, and a project asset found there wins. The shipped default sits beside the shipped actions asset instead, so the two travel together and neither shadows a project's own.
DEFAULT_CONTEXT_ID_CONSOLE
Context ID for the default Console context (priority 90).
Declaration
public const string DEFAULT_CONTEXT_ID_CONSOLE = "Console"
Field Value
| Type | Description |
|---|---|
| string |
DEFAULT_CONTEXT_ID_GAMEPLAY
Context ID for the default Gameplay context (priority 0).
Declaration
public const string DEFAULT_CONTEXT_ID_GAMEPLAY = "Gameplay"
Field Value
| Type | Description |
|---|---|
| string |
DEFAULT_CONTEXT_ID_GAMEPLAY_DEBUG
Context ID for the default debug-gameplay context (priority 50).
Declaration
public const string DEFAULT_CONTEXT_ID_GAMEPLAY_DEBUG = "Gameplay - Debug"
Field Value
| Type | Description |
|---|---|
| string |
DEFAULT_CONTEXT_ID_GLOBAL
Context ID for the default Global context (priority 95).
Declaration
public const string DEFAULT_CONTEXT_ID_GLOBAL = "Global"
Field Value
| Type | Description |
|---|---|
| string |
DEFAULT_CONTEXT_ID_MENU
Context ID for the default Menu context (priority 80).
Declaration
public const string DEFAULT_CONTEXT_ID_MENU = "Menu"
Field Value
| Type | Description |
|---|---|
| string |
DEFAULT_CONTEXT_ID_REBINDING
Context ID for the default Rebinding context (priority 100, consumes all input).
Declaration
public const string DEFAULT_CONTEXT_ID_REBINDING = "Rebinding"
Field Value
| Type | Description |
|---|---|
| string |
DEFAULT_EXCLUSIVE_TAG_MODE
Conflict-exclusive tag shared by every context that is a mode of its own, so a control two of them reuse is not reported as a conflict.
Declaration
public const string DEFAULT_EXCLUSIVE_TAG_MODE = "Mode"
Field Value
| Type | Description |
|---|---|
| string |
Remarks
Carried by every default context except Global and Rebinding. Global is left out because it genuinely is live alongside the others, so a control it shares with one of them is a real collision the author should see. Rebinding is left out because it enables no maps and so never takes part in a pair.
The tag is what the config layout's exclusion derivation reads. Without a tag in common, two contexts count as able to run together however their enabled and disabled map lists are written, and every control they share is reported.
DEFAULT_MAP_CONSOLE
Action map name for the in-game debug console actions, enabled by the Console context.
Declaration
public const string DEFAULT_MAP_CONSOLE = "Console"
Field Value
| Type | Description |
|---|---|
| string |
DEFAULT_MAP_GAMEPLAY_COMMON
Action map name for the shared gameplay actions, enabled by every gameplay context.
Declaration
public const string DEFAULT_MAP_GAMEPLAY_COMMON = "Gameplay - Common"
Field Value
| Type | Description |
|---|---|
| string |
DEFAULT_MAP_GAMEPLAY_DEBUG
Action map name for debug-only gameplay actions, enabled by the Gameplay - Debug context.
Declaration
public const string DEFAULT_MAP_GAMEPLAY_DEBUG = "Gameplay - Debug"
Field Value
| Type | Description |
|---|---|
| string |
DEFAULT_MAP_GAMEPLAY_ON_FOOT
Action map name for on-foot gameplay actions, enabled by the gameplay contexts.
Declaration
public const string DEFAULT_MAP_GAMEPLAY_ON_FOOT = "Gameplay - On Foot"
Field Value
| Type | Description |
|---|---|
| string |
DEFAULT_MAP_GLOBAL
Action map name for always-active global actions (screenshots, debug toggles), enabled by the Global context.
Declaration
public const string DEFAULT_MAP_GLOBAL = "Global"
Field Value
| Type | Description |
|---|---|
| string |
DEFAULT_MAP_MENU
Action map name for menu navigation actions, enabled by the Menu context.
Declaration
public const string DEFAULT_MAP_MENU = "Menu"
Field Value
| Type | Description |
|---|---|
| string |
GROUP_CONTEXT_DEFINITIONS
Config file group name that contains the array of context definition entries.
Declaration
public const string GROUP_CONTEXT_DEFINITIONS = "Context Definitions"
Field Value
| Type | Description |
|---|---|
| string |
KEY_BLOCKS_LOWER_PRIORITY
Config file property key for BlocksLowerPriority.
Declaration
public const string KEY_BLOCKS_LOWER_PRIORITY = "BlocksLowerPriority"
Field Value
| Type | Description |
|---|---|
| string |
KEY_CONFLICT_EXCLUSIVE_TAGS
Config file property key for the ConflictExclusiveTags string array.
Declaration
public const string KEY_CONFLICT_EXCLUSIVE_TAGS = "ConflictExclusiveTags"
Field Value
| Type | Description |
|---|---|
| string |
KEY_CONSUMES_ALL_INPUT
Config file property key for ConsumesAllInput.
Declaration
public const string KEY_CONSUMES_ALL_INPUT = "ConsumesAllInput"
Field Value
| Type | Description |
|---|---|
| string |
KEY_CONTEXTS
Config file property key for the context definitions array.
Declaration
public const string KEY_CONTEXTS = "Contexts"
Field Value
| Type | Description |
|---|---|
| string |
KEY_CONTEXT_ID
Config file property key for ContextID.
Declaration
public const string KEY_CONTEXT_ID = "ContextID"
Field Value
| Type | Description |
|---|---|
| string |
KEY_DESCRIPTION
Config file property key for Description.
Declaration
public const string KEY_DESCRIPTION = "Description"
Field Value
| Type | Description |
|---|---|
| string |
KEY_DISABLED_ACTION_MAPS
Config file property key for the DisabledActionMaps string array.
Declaration
public const string KEY_DISABLED_ACTION_MAPS = "DisabledActionMaps"
Field Value
| Type | Description |
|---|---|
| string |
KEY_DISPLAY_NAME
Config file property key for DisplayName.
Declaration
public const string KEY_DISPLAY_NAME = "DisplayName"
Field Value
| Type | Description |
|---|---|
| string |
KEY_ENABLED_ACTION_MAPS
Config file property key for the EnabledActionMaps string array.
Declaration
public const string KEY_ENABLED_ACTION_MAPS = "EnabledActionMaps"
Field Value
| Type | Description |
|---|---|
| string |
KEY_PRIORITY
Config file property key for Priority.
Declaration
public const string KEY_PRIORITY = "Priority"
Field Value
| Type | Description |
|---|---|
| string |
MSG_CONTEXT_MANAGER_NOT_AVAILABLE
Log message emitted when the context manager is unavailable during Apply().
Declaration
public const string MSG_CONTEXT_MANAGER_NOT_AVAILABLE = "Context manager not available."
Field Value
| Type | Description |
|---|---|
| string |
MSG_CONTEXT_NULL
Validation error message prefix used when a null entry is found in the definition list.
Declaration
public const string MSG_CONTEXT_NULL = "Context definition at index"
Field Value
| Type | Description |
|---|---|
| string |
MSG_DUPLICATE_CONTEXT_ID
Validation error message prefix used when two definitions share the same ContextID.
Declaration
public const string MSG_DUPLICATE_CONTEXT_ID = "Duplicate Context ID"
Field Value
| Type | Description |
|---|---|
| string |
MSG_ENTRIES_FROM_CONFIG
Log message suffix appended to MSG_REPLACED_CONTEXT_DEFINITIONS with the entry count.
Declaration
public const string MSG_ENTRIES_FROM_CONFIG = "entries from config file."
Field Value
| Type | Description |
|---|---|
| string |
MSG_INSTANCE_NOT_AVAILABLE
Log message emitted when Apply() is called before ScyllaInput has initialized.
Declaration
public const string MSG_INSTANCE_NOT_AVAILABLE = "ScyllaInput instance not available. Configuration will be applied when the module initializes."
Field Value
| Type | Description |
|---|---|
| string |
MSG_IS_NULL
Validation error message suffix appended to MSG_CONTEXT_NULL.
Declaration
public const string MSG_IS_NULL = "is null."
Field Value
| Type | Description |
|---|---|
| string |
MSG_NO_CONTEXTS_DEFINED
Validation info message emitted when the context definition list is empty or null.
Declaration
public const string MSG_NO_CONTEXTS_DEFINED = "No input contexts defined. Contexts can be registered programmatically."
Field Value
| Type | Description |
|---|---|
| string |
MSG_REGISTERED_CONTEXT
Log message prefix emitted when a context is successfully registered during Apply().
Declaration
public const string MSG_REGISTERED_CONTEXT = "Registered input context"
Field Value
| Type | Description |
|---|---|
| string |
MSG_REPLACED_CONTEXT_DEFINITIONS
Log message prefix emitted when the definition list is replaced by a config file override.
Declaration
public const string MSG_REPLACED_CONTEXT_DEFINITIONS = "Replaced context definitions list with"
Field Value
| Type | Description |
|---|---|
| string |
Properties
ContextDefinitions
Gets the read-only list of input context definitions authored in this asset. Each definition is converted to an InputContext and registered with the IInputContextManager when Apply() is called during module initialization. The list may be empty if no contexts have been defined; contexts can still be registered programmatically in that case.
Declaration
public IReadOnlyList<InputContextDefinition> ContextDefinitions { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<InputContextDefinition> |
Methods
Apply()
Registers each context definition from ContextDefinitions with the running Input module's IInputContextManager. Only definitions that are not already registered (checked via HasContext(string)) are added, so calling Apply() multiple times is safe. Definitions with a null or empty ContextID are silently skipped. Has no effect if Instance or its context manager is unavailable; warnings are logged in both cases.
Declaration
public override void Apply()
Overrides
ApplyConfigFileOverrides(ConfigFile)
Applies overrides from a config file to input context definitions.
Reads the "Context Definitions" group with a "Contexts" array property. Each array element is a Group containing context definition fields. The entire context definition list is replaced when the array is present in the config file. This is intentional: partial context lists could leave the system in an inconsistent state. Ensure the config file contains all desired context definitions.
Declaration
public override int ApplyConfigFileOverrides(ConfigFile configFile)
Parameters
| Type | Name | Description |
|---|---|---|
| ConfigFile | configFile | The Scylla.Core.Util.File.ConfigFile loaded by Scylla.Core.Config.ConfigFileManager for this
configuration. Will not be |
Returns
| Type | Description |
|---|---|
| int | The number of config-file properties that were successfully read and written to
serialized fields. A return value of |
Overrides
CreateDefaultContextDefinitions()
Creates and returns the built-in default set of InputContextDefinition objects. This method is called by ResetToDefaults() and can also be used programmatically to obtain a default context list for a fresh module setup.
Declaration
public static List<InputContextDefinition> CreateDefaultContextDefinitions()
Returns
| Type | Description |
|---|---|
| List<InputContextDefinition> | A new List<T> containing six pre-configured context definitions:
|
ExportToConfigFile()
Exports input context definitions to a config file.
Each context definition is stored as a Group element in an array property under the "Context Definitions" group. The conflict-exclusive tags and both action map lists are stored as arrays of string properties rather than joined strings, so entries containing commas survive the round trip. Empty lists are omitted from the file entirely.
Declaration
public override ConfigFile ExportToConfigFile()
Returns
| Type | Description |
|---|---|
| ConfigFile | A new Scylla.Core.Util.File.ConfigFile populated with the current configuration values, ready for serialization to JSON via Scylla.Core.Util.File.ConfigFile.ToJSON(). |
Overrides
GetConfigFileName()
Returns the file name that identifies this configuration asset within the Scylla configuration system. Used to locate the asset in Resources and to name exported JSON config files.
Declaration
public override string GetConfigFileName()
Returns
| Type | Description |
|---|---|
| string | The value of CONFIG_FILENAME. |
Overrides
LoadDefault()
Loads a project's own ScyllaInputContextConfiguration from the standard
Scylla configuration path in Resources, which is where the Input Wizard writes.
ScyllaInput calls this during initialization when no asset has been assigned in
the Inspector, and falls back to DEFAULT_CONTEXTS_PATH when it returns
null.
Declaration
public static ScyllaInputContextConfiguration LoadDefault()
Returns
| Type | Description |
|---|---|
| ScyllaInputContextConfiguration | The loaded ScyllaInputContextConfiguration asset, or |
ResetToDefaults()
Clears the current context definition list and replaces it with the built-in default set produced by CreateDefaultContextDefinitions(). The five default contexts (Gameplay, Gameplay - Debug, Menu, Console, Global) represent a sensible starting point for most projects.
Declaration
public override void ResetToDefaults()
Overrides
Validate()
Validates all context definitions in this asset and returns an array of diagnostic results. Checks include null entries, empty context IDs, duplicate context IDs, redundant flag combinations (ConsumesAllInput + BlocksLowerPriority), duplicate or empty action map names within each definition, and action maps that appear in both the enabled and disabled lists. Does not modify any field values.
Declaration
public override ConfigurationValidationResult[] Validate()
Returns
| Type | Description |
|---|---|
| ConfigurationValidationResult[] | An array of Scylla.Core.Config.ConfigurationValidationResult entries describing any problems found. An empty array means all definitions passed validation. An Info-level result is added when the definition list is empty, indicating that contexts must be registered programmatically instead. |