Class ScyllaEventConfiguration
Configuration asset for the Scylla Event eXchange System (SEX) that controls subscriber leak detection thresholds and exception handling behavior during event dispatch.
This configuration can be assigned to ScyllaBootstrap in the Inspector
to tune event bus behavior, or loaded automatically from the
Resources/Config/ folder at runtime via LoadDefault().
When neither is available, ScyllaBootstrap falls back to built-in default values.
Subscriber leak detection: The event bus monitors the number of active subscriptions per event type. When the count reaches SubscriberWarningThreshold, a warning is logged to alert developers to a potential subscription leak. When the count reaches SubscriberLimit, an InvalidOperationException is thrown to prevent unbounded memory growth.
Exception isolation: When ExceptionIsolation is enabled
(the default), handler exceptions are caught, logged, and dispatch continues to remaining
handlers. When disabled, the first handler exception propagates out of
Publish, which is useful during development for breaking on errors immediately.
Inherited Members
Namespace: Scylla.Core.Config
Assembly: ScyllaCore.dll
Syntax
[ScyllaCreateAsset("Core/Event Configuration", FileName = "Scylla Event Configuration")]
public sealed class ScyllaEventConfiguration : ScyllaConfiguration
Fields
CONFIG_FILENAME
Filename for auto-loading this configuration.
Declaration
public const string CONFIG_FILENAME = "Scylla Event Configuration"
Field Value
| Type | Description |
|---|---|
| string |
DEFAULT_EXCEPTION_ISOLATION
Default exception isolation setting.
Declaration
public const bool DEFAULT_EXCEPTION_ISOLATION = true
Field Value
| Type | Description |
|---|---|
| bool |
DEFAULT_SUBSCRIBER_LIMIT
Default subscriber hard limit.
Declaration
public const int DEFAULT_SUBSCRIBER_LIMIT = 1000
Field Value
| Type | Description |
|---|---|
| int |
DEFAULT_SUBSCRIBER_WARNING_THRESHOLD
Default subscriber warning threshold.
Declaration
public const int DEFAULT_SUBSCRIBER_WARNING_THRESHOLD = 100
Field Value
| Type | Description |
|---|---|
| int |
GROUP_EXCEPTION_HANDLING
Config file group name for exception handling settings.
Declaration
public const string GROUP_EXCEPTION_HANDLING = "Exception Handling"
Field Value
| Type | Description |
|---|---|
| string |
GROUP_SUBSCRIBER_LIMITS
Config file group name for subscriber limit settings.
Declaration
public const string GROUP_SUBSCRIBER_LIMITS = "Subscriber Limits"
Field Value
| Type | Description |
|---|---|
| string |
KEY_EXCEPTION_ISOLATION
Config file key for the ExceptionIsolation property.
Declaration
public const string KEY_EXCEPTION_ISOLATION = "ExceptionIsolation"
Field Value
| Type | Description |
|---|---|
| string |
KEY_SUBSCRIBER_LIMIT
Config file key for the SubscriberLimit property.
Declaration
public const string KEY_SUBSCRIBER_LIMIT = "SubscriberLimit"
Field Value
| Type | Description |
|---|---|
| string |
KEY_SUBSCRIBER_WARNING_THRESHOLD
Config file key for the SubscriberWarningThreshold property.
Declaration
public const string KEY_SUBSCRIBER_WARNING_THRESHOLD = "SubscriberWarningThreshold"
Field Value
| Type | Description |
|---|---|
| string |
MAX_SUBSCRIBER_LIMIT
Maximum allowed subscriber hard limit.
Declaration
public const int MAX_SUBSCRIBER_LIMIT = 100000
Field Value
| Type | Description |
|---|---|
| int |
MAX_SUBSCRIBER_WARNING_THRESHOLD
Maximum allowed subscriber warning threshold.
Declaration
public const int MAX_SUBSCRIBER_WARNING_THRESHOLD = 10000
Field Value
| Type | Description |
|---|---|
| int |
MIN_SUBSCRIBER_LIMIT
Minimum allowed subscriber hard limit.
Declaration
public const int MIN_SUBSCRIBER_LIMIT = 50
Field Value
| Type | Description |
|---|---|
| int |
MIN_SUBSCRIBER_WARNING_THRESHOLD
Minimum allowed subscriber warning threshold.
Declaration
public const int MIN_SUBSCRIBER_WARNING_THRESHOLD = 10
Field Value
| Type | Description |
|---|---|
| int |
Properties
ExceptionIsolation
Gets whether handler exceptions during event dispatch are isolated (caught and logged)
rather than propagated. When true (the default), one faulty handler does not
prevent other handlers from executing. When false, the first handler exception
propagates out of Publish.
Declaration
public bool ExceptionIsolation { get; }
Property Value
| Type | Description |
|---|---|
| bool |
|
SubscriberLimit
Gets the hard subscriber-count ceiling per event type. If the number of active
subscriptions for a given event type reaches this value, Listen throws
InvalidOperationException to prevent unbounded memory growth.
Declaration
public int SubscriberLimit { get; }
Property Value
| Type | Description |
|---|---|
| int | An integer in the range [MIN_SUBSCRIBER_LIMIT, MAX_SUBSCRIBER_LIMIT]. Defaults to DEFAULT_SUBSCRIBER_LIMIT (1000). |
SubscriberWarningThreshold
Gets the soft subscriber-count threshold per event type. When the number of active subscriptions for a given event type reaches this value, a warning is logged to indicate a potential subscription leak.
Declaration
public int SubscriberWarningThreshold { get; }
Property Value
| Type | Description |
|---|---|
| int | An integer in the range [MIN_SUBSCRIBER_WARNING_THRESHOLD, MAX_SUBSCRIBER_WARNING_THRESHOLD]. Defaults to DEFAULT_SUBSCRIBER_WARNING_THRESHOLD (100). |
Methods
Apply()
Applies this configuration to the runtime event system. This override is intentionally a no-op: the event bus reads configuration values at initialization time via ScyllaBootstrap and does not support live reconfiguration.
Declaration
public override void Apply()
Overrides
ApplyConfigFileOverrides(ConfigFile)
Applies overrides from a JSON ConfigFile to the fields of this configuration. All three settings are eligible for override: SubscriberWarningThreshold, SubscriberLimit, and ExceptionIsolation.
Declaration
public override int ApplyConfigFileOverrides(ConfigFile configFile)
Parameters
| Type | Name | Description |
|---|---|---|
| ConfigFile | configFile | The ConfigFile containing override values sourced from the JSON file on disk.
If |
Returns
| Type | Description |
|---|---|
| int | The number of fields successfully applied from the config file (0 to 3). |
Overrides
ExportToConfigFile()
Exports the current event configuration values to a ConfigFile for serialization to disk.
Declaration
public override ConfigFile ExportToConfigFile()
Returns
| Type | Description |
|---|---|
| ConfigFile | A new ConfigFile containing the exportable fields of the current configuration, ready to be written to the user documents or application folder by ConfigFileManager. |
Overrides
GetConfigFileName()
Returns the canonical filename of this configuration asset, used to resolve its location
within the Resources/Config/ folder and to derive the JSON config file base name
via GetConfigFileBaseName().
Declaration
public override string GetConfigFileName()
Returns
| Type | Description |
|---|---|
| string | The string |
Overrides
LoadDefault()
Loads the default event configuration asset from the Unity Resources folder.
The asset is expected at the path Resources/Config/Scylla Event Configuration,
constructed by combining CONFIG_FOLDER with
CONFIG_FILENAME via FilePathUtil.Combine.
Declaration
public static ScyllaEventConfiguration LoadDefault()
Returns
| Type | Description |
|---|---|
| ScyllaEventConfiguration | The ScyllaEventConfiguration asset found at the Resources path, or
|
ResetToDefaults()
Resets all configuration values to their built-in defaults:
Declaration
public override void ResetToDefaults()
Overrides
Validate()
Validates the event configuration and returns any issues found.
The following checks are performed:
- Error -- SubscriberWarningThreshold is below MIN_SUBSCRIBER_WARNING_THRESHOLD.
- Error -- SubscriberLimit is below MIN_SUBSCRIBER_LIMIT.
- Error -- SubscriberWarningThreshold is greater than or equal to SubscriberLimit (warning must fire before the hard limit).
- Warning -- ExceptionIsolation is disabled, which is not recommended for production builds.
Declaration
public override ConfigurationValidationResult[] Validate()
Returns
| Type | Description |
|---|---|
| ConfigurationValidationResult[] | An array of ConfigurationValidationResult entries describing any problems found. Returns an empty array when the configuration is valid. |