Struct ConfigurationValidationResult
An immutable, read-only value type that carries a single result produced by Validate().
Each result has a Severity level, a human-readable Message, and an optional FieldName that identifies which serialized field the result relates to. The field name is used by the custom Inspector to highlight the offending field directly in the Unity Inspector.
Use the static factory methods Info(string, string), Warning(string, string), and Error(string, string) rather than the constructor directly, as they make call-site intent immediately clear.
Inherited Members
Namespace: Scylla.Core.Config
Assembly: ScyllaCore.dll
Syntax
public readonly struct ConfigurationValidationResult
Constructors
ConfigurationValidationResult(ValidationSeverity, string, string)
Initializes a new ConfigurationValidationResult with the given severity, message, and optional field name.
Prefer the static factory methods Info(string, string), Warning(string, string), and Error(string, string) over this constructor for clearer call-site intent.
Declaration
public ConfigurationValidationResult(ValidationSeverity severity, string message, string fieldName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ValidationSeverity | severity | The severity level of this result. Determines whether IsValid() treats it as a blocking error. |
| string | message | A human-readable description of the issue or information.
Results with a |
| string | fieldName | Optional. The exact C# backing-field name of the serialized property this result
relates to (e.g. |
Properties
FieldName
Gets the name of the serialized field associated with this result, or null
if the result is not tied to a specific field.
When provided, this value must match the exact C# backing-field name (e.g.
"_initializationDelay") so that the custom Inspector can locate and
visually highlight the offending field in the Unity Inspector window.
Omit this value for results that apply to the configuration as a whole
rather than to an individual field.
Declaration
public string FieldName { get; }
Property Value
| Type | Description |
|---|---|
| string | The backing-field name of the affected serialized property, or |
Message
Gets the human-readable message that describes the validation result.
Should be specific and actionable - ideally including the current offending
value and a suggested correction. Results with a null or empty message
are silently filtered out by BuildValidationResults(params ConfigurationValidationResult[]).
Declaration
public string Message { get; }
Property Value
| Type | Description |
|---|---|
| string | A non-null, non-empty string when produced by the static factory methods. |
Severity
Gets the severity level that classifies this validation result.
Determines whether the result is treated as informational, a warning, or an error
that causes IsValid() to return false.
Declaration
public ValidationSeverity Severity { get; }
Property Value
| Type | Description |
|---|---|
| ValidationSeverity | One of the ValidationSeverity enum values. |
Methods
Error(string, string)
Creates a ConfigurationValidationResult with
Error severity.
Use this factory when the configuration state is invalid and must be corrected
before the configuration can be safely used. Any Error result causes
IsValid() to return false.
Declaration
public static ConfigurationValidationResult Error(string message, string fieldName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | A human-readable error message that clearly identifies the problem and, where
possible, states the invalid value and the expected valid range or condition.
Results with a |
| string | fieldName | Optional. The exact C# backing-field name of the serialized property this result
relates to, used by the Inspector for field highlighting. Pass |
Returns
| Type | Description |
|---|---|
| ConfigurationValidationResult | A new ConfigurationValidationResult with Error severity. |
Info(string, string)
Creates a ConfigurationValidationResult with Info severity. Use this factory to surface contextual information about the configuration state without implying a problem. The result will not affect IsValid().
Declaration
public static ConfigurationValidationResult Info(string message, string fieldName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | A human-readable informational message. Should be specific and self-contained.
Results with a |
| string | fieldName | Optional. The exact C# backing-field name of the serialized property this result
relates to, used by the Inspector for field highlighting. Pass |
Returns
| Type | Description |
|---|---|
| ConfigurationValidationResult | A new ConfigurationValidationResult with Info severity. |
Warning(string, string)
Creates a ConfigurationValidationResult with Warning severity. Use this factory when the configuration value is technically acceptable but may cause degraded behaviour or subtle bugs at runtime. The result will not affect IsValid(); the configuration is still considered usable.
Declaration
public static ConfigurationValidationResult Warning(string message, string fieldName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | A human-readable warning message that clearly explains the potential problem
and, where possible, suggests a corrective action.
Results with a |
| string | fieldName | Optional. The exact C# backing-field name of the serialized property this result
relates to, used by the Inspector for field highlighting. Pass |
Returns
| Type | Description |
|---|---|
| ConfigurationValidationResult | A new ConfigurationValidationResult with Warning severity. |