Class ScyllaConfiguration
Abstract base class for all Scylla configuration UnityEngine.ScriptableObject assets. Provides a shared contract for validation, default-reset, runtime application, and config-file integration across every module configuration in the framework.
Concrete subclasses must implement Validate() to return ConfigurationValidationResult diagnostics and ResetToDefaults() to restore all fields to their authored defaults. Optionally, subclasses can override Apply() to push configuration values to live runtime systems, GetConfigFileName() to declare a config-file name for JSON override support, ApplyConfigFileOverrides(ConfigFile) to read values from a loaded ConfigFile, and ExportToConfigFile() to write current values back to a ConfigFile.
The config-file system uses a two-level enable gate: the global switch on ScyllaCoreConfiguration (managed by ConfigFileManager) must be on, and the per-configuration switch exposed by IsConfigFileEnabledForCurrentBuild() must also be on, before any JSON overrides are applied to a configuration.
In the Unity Editor, any change made to an Inspector field during Play Mode automatically schedules a deferred call to Apply() so that runtime systems reflect the updated values immediately without requiring a restart.
Inheritance
Inherited Members
Namespace: Scylla.Core.Config
Assembly: ScyllaCore.dll
Syntax
public abstract class ScyllaConfiguration : ScriptableObject
Fields
CONFIG_FOLDER
The subfolder name within the Unity Resources directory where Scylla
configuration assets are stored and loaded from at runtime via
Resources.Load.
Declaration
public const string CONFIG_FOLDER = "Config"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_ACTIONS
Inspector section label for the editor action buttons (Validate, Reset, Apply, Export).
Declaration
public const string LABEL_ACTIONS = "Actions"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_APPLY_NOW
Inspector button label for the Apply Now action, which immediately pushes current configuration values to the live runtime system during Play Mode.
Declaration
public const string LABEL_APPLY_NOW = "Apply Now"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_ASSET_PATH
Inspector label for the asset path display field.
Declaration
public const string LABEL_ASSET_PATH = "Asset Path"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_CONFIGURATION
Inspector section label for the main configuration values area.
Declaration
public const string LABEL_CONFIGURATION = "Configuration"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_CONFIG_FILE
Inspector label for a single config-file setting.
Declaration
public const string LABEL_CONFIG_FILE = "Config File"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_CONFIG_FILES
Inspector section label for the collective config-file settings group.
Declaration
public const string LABEL_CONFIG_FILES = "Config Files"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_CONFIG_FILES_IN_DBG
Inspector label for the global debug-build config-file enable toggle.
Declaration
public const string LABEL_CONFIG_FILES_IN_DBG = "Config Files in DBG"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_CONFIG_FILES_IN_PRD
Inspector label for the global production-build config-file enable toggle.
Declaration
public const string LABEL_CONFIG_FILES_IN_PRD = "Config Files in PRD"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_CONFIG_FILE_IN_DBG
Inspector label for the per-configuration debug-build config-file enable toggle.
Declaration
public const string LABEL_CONFIG_FILE_IN_DBG = "Config File in DBG"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_CONFIG_FILE_IN_PRD
Inspector label for the per-configuration production-build config-file enable toggle.
Declaration
public const string LABEL_CONFIG_FILE_IN_PRD = "Config File in PRD"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_CORE
Inspector label for the Core module scope indicator.
Declaration
public const string LABEL_CORE = "Core"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_ERROR
Inspector label used to prefix error-severity validation messages.
Declaration
public const string LABEL_ERROR = "Error"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_EXPORT_CONFIG_FILE
Inspector button label for the Export Config File action.
Declaration
public const string LABEL_EXPORT_CONFIG_FILE = "Export Config File"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_GLOBAL
Inspector label for the global scope indicator used in config-file section headers.
Declaration
public const string LABEL_GLOBAL = "Global"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_METADATA
Inspector section label for the configuration metadata area (name and description).
Declaration
public const string LABEL_METADATA = "Metadata"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_RESET_TO_DEFAULTS
Inspector button label for the Reset to Defaults action.
Declaration
public const string LABEL_RESET_TO_DEFAULTS = "Reset to Defaults"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_RESOURCE_PATH
Inspector label for the resource path display field.
Declaration
public const string LABEL_RESOURCE_PATH = "Resource Path"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_TO_APP_FOLDER
Export-destination label for writing config files to the application data folder.
Declaration
public const string LABEL_TO_APP_FOLDER = "To App Folder"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_TO_USER_DOCUMENTS
Export-destination label for writing config files to the user's Documents folder.
Declaration
public const string LABEL_TO_USER_DOCUMENTS = "To User Documents"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_VALIDATE
Inspector button label for the Validate action.
Declaration
public const string LABEL_VALIDATE = "Validate"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_VALIDATION
Inspector section label for the validation results area.
Declaration
public const string LABEL_VALIDATION = "Validation"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_WARNING
Inspector label used to prefix warning-severity validation messages.
Declaration
public const string LABEL_WARNING = "Warning"
Field Value
| Type | Description |
|---|---|
| string |
MSG_CANCEL_BUTTON
Label for the cancel button in confirmation dialogs.
Declaration
public const string MSG_CANCEL_BUTTON = "Cancel"
Field Value
| Type | Description |
|---|---|
| string |
MSG_EXPORT_CONFIG_TITLE
Title text for the Export Config File dialog.
Declaration
public const string MSG_EXPORT_CONFIG_TITLE = "Export Config File"
Field Value
| Type | Description |
|---|---|
| string |
MSG_OK_BUTTON
Label for the generic OK/dismiss button in informational dialogs.
Declaration
public const string MSG_OK_BUTTON = "OK"
Field Value
| Type | Description |
|---|---|
| string |
MSG_OVERWRITE_BUTTON
Label for the overwrite button shown in the Export Config File dialog when a file already exists at the chosen destination.
Declaration
public const string MSG_OVERWRITE_BUTTON = "Overwrite"
Field Value
| Type | Description |
|---|---|
| string |
MSG_RESET_BUTTON
Label for the confirm button in the Reset to Defaults dialog.
Declaration
public const string MSG_RESET_BUTTON = "Reset"
Field Value
| Type | Description |
|---|---|
| string |
MSG_RESET_CONFIRM_BODY
Body text for the Reset to Defaults confirmation dialog, asking the user to confirm that all values will be overwritten with their defaults.
Declaration
public const string MSG_RESET_CONFIRM_BODY = "Are you sure you want to reset all configuration values to their defaults?"
Field Value
| Type | Description |
|---|---|
| string |
MSG_RESET_CONFIRM_TITLE
Title text for the Reset to Defaults confirmation dialog.
Declaration
public const string MSG_RESET_CONFIRM_TITLE = "Reset to Defaults"
Field Value
| Type | Description |
|---|---|
| string |
MSG_VALIDATION_TITLE
Title text for the validation results dialog shown when the Validate action is triggered.
Declaration
public const string MSG_VALIDATION_TITLE = "Validation"
Field Value
| Type | Description |
|---|---|
| string |
Properties
ConfigFileEnabledInDebugBuild
Gets whether the JSON config-file override mechanism is enabled for this configuration in debug builds (Unity Editor and Development Builds).
This is a per-configuration switch. The global switch on ScyllaCoreConfiguration (managed by ConfigFileManager) must also be enabled for overrides to take effect. Use IsConfigFileEnabledForCurrentBuild() to evaluate both the per-config and global switches simultaneously for the current build type.
Declaration
public bool ConfigFileEnabledInDebugBuild { get; }
Property Value
| Type | Description |
|---|---|
| bool |
|
ConfigFileEnabledInProductionBuild
Gets whether the JSON config-file override mechanism is enabled for this configuration in production (non-development) builds.
This is a per-configuration switch. The global switch on ScyllaCoreConfiguration (managed by ConfigFileManager) must also be enabled for overrides to take effect. Use IsConfigFileEnabledForCurrentBuild() to evaluate both the per-config and global switches simultaneously for the current build type.
Declaration
public bool ConfigFileEnabledInProductionBuild { get; }
Property Value
| Type | Description |
|---|---|
| bool |
|
ConfigurationName
Gets the human-readable display name for this configuration asset. Used in the Inspector header and in diagnostic messages to identify which configuration is being described.
Declaration
public string ConfigurationName { get; }
Property Value
| Type | Description |
|---|---|
| string | The value of the |
CreateConfigFile
Gets whether this configuration should automatically create a JSON config file populated with its current values on first launch if no file is found in the user folder.
Auto-creation only occurs when both this property and the global
CreateEnabled switch are true.
Auto-creating config files makes it easy for end-users and QA to discover
and override settings without having to construct the file manually.
Declaration
public bool CreateConfigFile { get; }
Property Value
| Type | Description |
|---|---|
| bool |
|
Description
Gets the optional free-text description for this configuration asset, as set by the custom Inspector. Intended for developer documentation purposes only; not consumed by the framework at runtime.
Declaration
public string Description { get; }
Property Value
| Type | Description |
|---|---|
| string | The description string, or |
Methods
Apply()
Pushes the current configuration values to the live runtime system. Override this method in derived classes to update module state whenever the configuration changes - for example, to reconfigure a logging sink, update a render pipeline setting, or resize an internal buffer.
During Play Mode in the Unity Editor, the framework automatically schedules
a deferred call to Apply whenever a field value changes in the Inspector
(via the OnValidate callback), enabling live iteration without a
domain reload. This method is also exposed as the "Apply Now" button in the
custom Inspector.
The base implementation does nothing. If a configuration's settings are only consumed at startup (e.g. ScyllaCoreConfiguration), the override may remain empty.
Declaration
public virtual void Apply()
ApplyConfigFileOverrides(ConfigFile)
Reads property values from a loaded ConfigFile and writes them into this configuration's serialized fields, effectively applying user or environment overrides on top of the Inspector-authored defaults.
Override in derived classes to map specific config-file group/key pairs to their corresponding serialized fields. Only fields that are present in the config file should be updated; fields missing from the file should retain their current values. Return the count of properties that were successfully read and applied so callers can log accurate diagnostic information.
The base implementation does nothing and returns 0. Subclasses that
return null from GetConfigFileName() do not need to
override this method.
Declaration
public virtual int ApplyConfigFileOverrides(ConfigFile configFile)
Parameters
| Type | Name | Description |
|---|---|---|
| ConfigFile | configFile | The ConfigFile loaded by 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 |
BuildValidationResults(params ConfigurationValidationResult[])
Convenience helper for assembling the return value of Validate().
Accepts a variable-length list of ConfigurationValidationResult values,
filters out any entries whose Message is
null or empty (which guards against accidentally including unconstructed
default struct values), and returns the remaining results as a heap-allocated array.
Usage pattern in a Validate() override:
<pre><code class="lang-csharp">public override ConfigurationValidationResult[] Validate()
{ return BuildValidationResults( _value < 0 ? ConfigurationValidationResult.Error("Value must be non-negative.", "_value") : default, ConfigurationValidationResult.Info($"Computed limit: {_value * 2}") ); }
Passing <code>default</code> for a result that does not apply is safe because the
empty-message filter will discard it.
Declaration
protected ConfigurationValidationResult[] BuildValidationResults(params ConfigurationValidationResult[] results)
Parameters
| Type | Name | Description |
|---|---|---|
| ConfigurationValidationResult[] | results | Zero or more ConfigurationValidationResult values to include in the
output. Results with a |
Returns
| Type | Description |
|---|---|
| ConfigurationValidationResult[] | A new array containing only the results that have a non-empty message, in the same order they were provided. Returns Empty<T>() if no valid results remain after filtering. |
ExportToConfigFile()
Serializes the current values of this configuration's fields into a new ConfigFile suitable for saving to disk.
Override in derived classes to write each relevant serialized field into the appropriate group and key within the returned ConfigFile. The resulting file is used both by the Inspector "Export Config File" action and by the auto-create mechanism in ConfigFileManager. Group and key names must match those read in ApplyConfigFileOverrides(ConfigFile).
The base implementation returns an empty ConfigFile with no
groups. Subclasses that return null from GetConfigFileName()
do not need to override this method.
Declaration
public virtual ConfigFile ExportToConfigFile()
Returns
| Type | Description |
|---|---|
| ConfigFile | A new ConfigFile populated with the current configuration values, ready for serialization to JSON via ToJSON(). |
GetConfigFileBaseName()
Derives the compact base name used as the JSON filename stem for this configuration.
Strips the standard "Scylla " prefix and " Configuration" suffix from
the value returned by GetConfigFileName(), then removes any remaining
spaces to produce a PascalCase identifier.
Examples:
"Scylla Core Configuration"yields"Core""Scylla Debug Console Configuration"yields"DebugConsole"- Non-standard names are returned as-is with spaces removed.
Override this method when a concrete configuration requires a custom filename
mapping that does not follow the "Scylla [Name] Configuration" convention.
Declaration
public virtual string GetConfigFileBaseName()
Returns
| Type | Description |
|---|---|
| string | The compact, space-free base name used as the JSON filename stem (e.g. |
GetConfigFileName()
Returns the display name used as the key for loading and saving the JSON config file associated with this configuration type.
The returned name should follow the Scylla convention
"Scylla [Name] Configuration" (e.g. "Scylla Core Configuration")
so that GetConfigFileBaseName() can derive the compact base name
("Core") used for the actual JSON filename on disk. Override this method
in concrete subclasses that support config-file overrides; the default returns
null, which disables config-file support for that configuration type.
Declaration
public virtual string GetConfigFileName()
Returns
| Type | Description |
|---|---|
| string | The full configuration name string (e.g. |
IsConfigFileEnabledForCurrentBuild()
Returns whether the JSON config-file override mechanism is enabled for this configuration in the currently running build, taking into account both the per-configuration toggles and Unity's debug-build flag.
This method evaluates only the per-configuration side of the two-level enable gate. The caller is responsible for also checking the global IsEnabled switch before applying any overrides.
Declaration
public virtual bool IsConfigFileEnabledForCurrentBuild()
Returns
| Type | Description |
|---|---|
| bool |
|
IsValid()
Determines whether the configuration currently has any Error-severity validation results. Provides a fast, single-call validity check without requiring the caller to inspect the full result array.
Declaration
public virtual bool IsValid()
Returns
| Type | Description |
|---|---|
| bool |
|
Reset()
Unity callback invoked when the UnityEngine.ScriptableObject asset is first created
or when the user selects "Reset" from the Inspector context menu.
Restores the base-class config-file switches (Scylla.Core.Config.ScyllaConfiguration._configFileEnabledInDebugBuild,
Scylla.Core.Config.ScyllaConfiguration._configFileEnabledInProductionBuild, Scylla.Core.Config.ScyllaConfiguration._createConfigFile) to
their defaults (true), then delegates to ResetToDefaults() so that
derived-class fields are also restored.
Subclasses that need additional reset logic beyond field values should override ResetToDefaults() rather than this method to preserve the base-class switch initialization.
Declaration
protected virtual void Reset()
ResetToDefaults()
Resets every serialized field in this configuration back to its authored default value, discarding any user edits.
Called by the base class Reset() Unity callback (triggered when the asset is created or when the user selects Reset in the Inspector context menu), and also exposed as an explicit editor action via the custom Inspector's "Reset to Defaults" button. Implementations should set every field to the same value it would have immediately after a fresh asset creation.
Declaration
public abstract void ResetToDefaults()
Validate()
Validates all serialized fields in this configuration and returns diagnostic results. Called by the framework at startup (to detect invalid configurations early), by the custom Inspector when the user clicks the Validate button, and by IsValid() when a quick validity check is needed.
Implementations should check every field that has a defined valid range or dependency and produce a ConfigurationValidationResult for each issue found. Use Error(string, string) for values that render the configuration unusable, Warning(string, string) for values that are technically valid but may cause problems, and Info(string, string) for contextual information. Use BuildValidationResults(params ConfigurationValidationResult[]) to conveniently assemble the return array.
Declaration
public abstract ConfigurationValidationResult[] Validate()
Returns
| Type | Description |
|---|---|
| ConfigurationValidationResult[] | An array of ConfigurationValidationResult values describing all discovered issues. Return an empty array (or use Empty<T>()) if all fields are valid. |