Class ScyllaProjectSettings
Project-wide configuration owned by Scylla Core. Surfaced in Unity's Project
Settings window under Edit > Project Settings > Scylla. Holds settings
that need to be shared between modules without forcing them to depend on each
other - first up: the canonical color asset paths used by Demos, UI, and Chroma.
Inherited Members
Namespace: Scylla.Core.Settings
Assembly: ScyllaCore.dll
Syntax
public sealed class ScyllaProjectSettings : ScriptableObject
Remarks
Storage. The asset is created on demand at
Assets/Scylla/Resources/ScyllaProjectSettings.asset. Living under a
Resources folder makes it accessible from runtime code via
Resources.Load; the editor settings provider can also load and edit
it via the standard ScriptableObject inspection flow.
Color paths. Three fields cooperate to describe where color assets live in the project:
-
ColorDirectory - the shared root, default
"Assets/Scylla/Resources/Color". Hosts theChroma Swatches.assetdirectly. -
PalettesSubdirectory - subfolder under the root for
every
ColorPaletteAsset(default"Palettes"). -
GradientsSubdirectory - subfolder under the root for
every
ColorGradientAsset(default"Gradients").
Validity. HasResourcesSegment(string) verifies
the configured paths contain a Resources path segment so
LoadAll<T>(string) will discover the
generated assets at runtime. Generators and consumers should call
LogPathWarningIfInvalid(string) before writing to surface bad
configuration via Log.
Thread safety. The static Instance accessor is thread-safe for initial creation. The setters are not - callers should use them only from the Unity main thread (typically the editor settings UI).
Fields
DEFAULT_COLOR_DIRECTORY
Default value for ColorDirectory.
Declaration
public const string DEFAULT_COLOR_DIRECTORY = "Assets/Scylla/Resources/Color"
Field Value
| Type | Description |
|---|---|
| string |
DEFAULT_GRADIENTS_SUBDIRECTORY
Default value for GradientsSubdirectory.
Declaration
public const string DEFAULT_GRADIENTS_SUBDIRECTORY = "Gradients"
Field Value
| Type | Description |
|---|---|
| string |
DEFAULT_PALETTES_SUBDIRECTORY
Default value for PalettesSubdirectory.
Declaration
public const string DEFAULT_PALETTES_SUBDIRECTORY = "Palettes"
Field Value
| Type | Description |
|---|---|
| string |
RESOURCES_PATH
Resources lookup name (without extension) for the singleton asset.
Declaration
public const string RESOURCES_PATH = "ScyllaProjectSettings"
Field Value
| Type | Description |
|---|---|
| string |
RESOURCES_SEGMENT
Path segment LoadAll<T>(string) requires.
Declaration
public const string RESOURCES_SEGMENT = "Resources"
Field Value
| Type | Description |
|---|---|
| string |
Properties
ColorDirectory
Project-relative root directory for color assets.
Declaration
public string ColorDirectory { get; }
Property Value
| Type | Description |
|---|---|
| string |
GradientDirectory
Combined directory path for color gradient assets. Cached.
Declaration
public string GradientDirectory { get; }
Property Value
| Type | Description |
|---|---|
| string |
GradientsSubdirectory
Subfolder name (relative to ColorDirectory) for gradient assets.
Declaration
public string GradientsSubdirectory { get; }
Property Value
| Type | Description |
|---|---|
| string |
Instance
Gets the singleton settings instance. Loads from
Resources/ScyllaProjectSettings on first access; falls back to a
transient default-valued instance if the asset has not been created yet.
Declaration
public static ScyllaProjectSettings Instance { get; }
Property Value
| Type | Description |
|---|---|
| ScyllaProjectSettings |
Remarks
Must not be called from a UnityEngine.ScriptableObject constructor, field
initializer, serialization callback, or any context where
Resources.Load and ScriptableObject.CreateInstance are
forbidden. Doing so will throw UnityEngine.UnityException rather than
silently substituting an unsafe-context fallback.
IsGradientDirectoryValid
Whether GradientDirectory contains a Resources segment.
Declaration
public bool IsGradientDirectoryValid { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsPaletteDirectoryValid
Whether PaletteDirectory contains a Resources segment.
Required for LoadAll<T>(string) discovery
to find palette assets at runtime.
Declaration
public bool IsPaletteDirectoryValid { get; }
Property Value
| Type | Description |
|---|---|
| bool |
PaletteDirectory
Combined directory path for color palette assets. Cached after first
access; invalidated by any setter write or by Unity's OnValidate
after Inspector edits.
Declaration
public string PaletteDirectory { get; }
Property Value
| Type | Description |
|---|---|
| string |
PalettesSubdirectory
Subfolder name (relative to ColorDirectory) for palette assets.
Declaration
public string PalettesSubdirectory { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
CombineColorPath(string, string)
Combines a color root with a subdirectory name into a forward-slash path.
Trims redundant separators so user input like "/Palettes/" still
produces a clean Asset Database path. An empty subdirectory returns the
root unchanged so callers like the swatches collection can sit directly
under the color root.
Declaration
public static string CombineColorPath(string root, string subdirectory)
Parameters
| Type | Name | Description |
|---|---|---|
| string | root | |
| string | subdirectory |
Returns
| Type | Description |
|---|---|
| string |
HasResourcesSegment(string)
Tests whether a project-relative path contains a Resources path segment
(case-sensitive, matching Unity's runtime asset bundling behaviour).
Allocation-free single-pass scan over both / and backslash separators.
Declaration
public static bool HasResourcesSegment(string path)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path |
Returns
| Type | Description |
|---|---|
| bool |
LogPathWarningIfInvalid(string)
Logs a Warning(object, string, int) describing the invalid path(s) when either
palette or gradient directory lacks a Resources segment. Returns
true when both paths are valid so callers can branch on the result.
Declaration
public bool LogPathWarningIfInvalid(string contextLabel)
Parameters
| Type | Name | Description |
|---|---|---|
| string | contextLabel | Short label identifying the caller (e.g. |
Returns
| Type | Description |
|---|---|
| bool |
|
SetColorDirectory(string)
Sets the color directory. Editor-only callers should follow up with
EditorUtility.SetDirty + AssetDatabase.SaveAssets to persist.
Declaration
public void SetColorDirectory(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value |
SetGradientsSubdirectory(string)
Sets the gradients subdirectory.
Declaration
public void SetGradientsSubdirectory(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value |
SetPalettesSubdirectory(string)
Sets the palettes subdirectory.
Declaration
public void SetPalettesSubdirectory(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value |