Class ScyllaUILayoutStyle
Shared style preset for Scylla UI Layout stacks. Holds default padding, spacing, and alignment values plus an ordered list of aspect-ratio breakpoints. References by many ScyllaUIStackBase instances enable project-wide restyling by editing a single asset; conceptually a CSS-class analog.
Inherited Members
Namespace: Scylla.Core.Util.UI
Assembly: ScyllaCore.dll
Syntax
[ScyllaCreateAsset("UI/Layout/Layout Style", FileName = "ScyllaUILayoutStyle")]
public sealed class ScyllaUILayoutStyle : ScriptableObject
Remarks
Follows the simple ScriptableObject + [ScyllaCreateAsset] pattern
used elsewhere in Scylla Core (e.g. ColorPaletteAsset); does not derive
from ScyllaConfiguration so the style does not carry JSON-export
plumbing or validation severity machinery.
Stacks assigned a style read padding, spacing, and alignment from the style at
solve time. Breakpoints are evaluated against the parent's
current aspect ratio; the highest matching breakpoint's Override*
values replace the base style values for that solve. Stacks with no style
continue to use their own serialized fields directly.
Properties
Alignment
Default main-axis distribution mode that controls how free space is allocated among children (e.g. Start, Center, SpaceBetween). Stacks read the effective value via ResolveAlignment(float); a breakpoint's AlignmentOverride replaces this base value when its threshold is met.
Declaration
public ScyllaUIAlignment Alignment { get; set; }
Property Value
| Type | Description |
|---|---|
| ScyllaUIAlignment |
Breakpoints
Ordered list of aspect-ratio breakpoints, sorted ascending by
MinAspectRatio. Exposed as
IReadOnlyList<T> to signal that external code should not mutate the
list directly; use AddBreakpoint(ScyllaUIAspectBreakpoint) to append entries (re-sorts
automatically) and ClearBreakpoints() to remove all entries. In the
Inspector, breakpoints are authored directly in the serialized list and the order
is corrected on load via OnEnable and on edit via OnValidate.
Declaration
public IReadOnlyList<ScyllaUIAspectBreakpoint> Breakpoints { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<ScyllaUIAspectBreakpoint> |
CrossAlignment
Default cross-axis alignment applied to children when no matching breakpoint overrides it. Defaults to Stretch, which expands children to fill the full cross-axis extent. Unlike padding, spacing, and main-axis alignment, cross-axis alignment is not overridable per breakpoint.
Declaration
public ScyllaUICrossAlignment CrossAlignment { get; set; }
Property Value
| Type | Description |
|---|---|
| ScyllaUICrossAlignment |
Padding
Default per-edge inner padding applied to every stack that references this style. Specifies the inset from the stack's inner content origin to where children begin. At solve time ResolvePadding(float) is called with the current viewport aspect ratio; if a matching breakpoint overrides padding, the breakpoint value is used instead of this base value.
Declaration
public ScyllaUIEdgeInsets Padding { get; set; }
Property Value
| Type | Description |
|---|---|
| ScyllaUIEdgeInsets |
Spacing
Default main-axis gap inserted between consecutive child elements. Applied by stacks that reference this style unless a matching ScyllaUIAspectBreakpoint supplies a SpacingOverride. Use ResolveSpacing(float) to obtain the effective value for a given aspect ratio.
Declaration
public ScyllaUILength Spacing { get; set; }
Property Value
| Type | Description |
|---|---|
| ScyllaUILength |
Methods
AddBreakpoint(ScyllaUIAspectBreakpoint)
Appends a new aspect-ratio breakpoint to this style's ordered breakpoint list and re-sorts the list by ascending MinAspectRatio. Intended for code that builds styles in memory (demos, runtime configuration); editing breakpoints on imported assets normally happens through the Inspector.
Declaration
public void AddBreakpoint(ScyllaUIAspectBreakpoint breakpoint)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaUIAspectBreakpoint | breakpoint | The breakpoint to add. Its override flags determine which style properties it replaces when the viewport aspect ratio matches. |
ClearBreakpoints()
Clears every breakpoint from this style.
Declaration
public void ClearBreakpoints()
ResolveAlignment(float)
Resolves the effective main-axis alignment for the supplied aspect ratio by walking the ordered breakpoint list and applying the highest matching AlignmentOverride.
Declaration
public ScyllaUIAlignment ResolveAlignment(float aspectRatio)
Parameters
| Type | Name | Description |
|---|---|---|
| float | aspectRatio | Current viewport aspect ratio (width / height). |
Returns
| Type | Description |
|---|---|
| ScyllaUIAlignment | The effective ScyllaUIAlignment for the given aspect ratio. Returns Alignment when no breakpoint matches or no alignment override is active. |
ResolvePadding(float)
Resolves the effective padding for the supplied aspect ratio by walking the ordered breakpoint list and applying the highest matching PaddingOverride.
Declaration
public ScyllaUIEdgeInsets ResolvePadding(float aspectRatio)
Parameters
| Type | Name | Description |
|---|---|---|
| float | aspectRatio | Current viewport aspect ratio (width / height). |
Returns
| Type | Description |
|---|---|
| ScyllaUIEdgeInsets | The effective ScyllaUIEdgeInsets for the given aspect ratio. Returns Padding when no breakpoint matches or no padding override is active. |
ResolveSpacing(float)
Resolves the effective main-axis spacing between children for the supplied aspect ratio by walking the ordered breakpoint list and applying the highest matching SpacingOverride.
Declaration
public ScyllaUILength ResolveSpacing(float aspectRatio)
Parameters
| Type | Name | Description |
|---|---|---|
| float | aspectRatio | Current viewport aspect ratio (width / height). |
Returns
| Type | Description |
|---|---|
| ScyllaUILength | The effective ScyllaUILength spacing value for the given aspect ratio. Returns Spacing when no breakpoint matches or no spacing override is active. |