Class ScyllaUIFlexElement
Per-child layout descriptor used by a Scylla UI stack to allocate main-axis space,
constrain cross-axis size, and opt the child out of the solve entirely. Conceptually
equivalent to Unity's LayoutElement but with grow and shrink weights and
ScyllaUILength-based size bounds.
Inherited Members
Namespace: Scylla.Core.Util.UI
Assembly: ScyllaCore.dll
Syntax
[AddComponentMenu("Scylla/UI/Layout/Flex Element")]
[DisallowMultipleComponent]
[RequireComponent(typeof(RectTransform))]
[ExecuteAlways]
public sealed class ScyllaUIFlexElement : MonoBehaviour
Remarks
A child without a ScyllaUIFlexElement is treated as if it had a
default-valued one: no grow, shrink weight 1, preferred sizes derived from the
child's intrinsic content (its ILayoutElement preferred sizes or its
current RectTransform rect). Attach this component to override any of
those defaults.
GrowWeight distributes positive free space along the main axis proportionally: a child with weight 2 receives twice the extra space as a child with weight 1. ShrinkWeight distributes negative free space (i.e. when children would overflow the stack) so heavier children shrink more.
MinWidth and MinHeight set hard lower bounds on each axis. During shrink distribution the solver never reduces a child below its minimum, even if that causes overflow of the stack boundary.
Set IgnoreLayout to true to exclude this child from the
solve entirely, for example to hide it without destroying the GameObject.
Any property change marks the parent stack dirty and schedules a re-solve via MarkDirty().
Properties
FitMode
Fit mode controlling how the child uses its allocated slot. Currently reserved; the solver treats all children as Loose regardless of this value. Exposed for future use once Tight fit is implemented.
Declaration
public ScyllaUIFitMode FitMode { get; set; }
Property Value
| Type | Description |
|---|---|
| ScyllaUIFitMode |
GrowWeight
Proportional share of positive free space on the main axis. A weight of
0 means the child does not grow beyond its preferred size. A weight
of 2 receives twice the free space as a sibling with weight 1.
Negative values are clamped to 0.
Declaration
public float GrowWeight { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
IgnoreLayout
When true, the solver skips this child as if its GameObject were
inactive. The RectTransform is left at its last solved position. Setting this
to false re-includes the child and marks the parent dirty.
Declaration
public bool IgnoreLayout { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
MinHeight
Hard lower bound on this child's height. The solver never allocates less than the resolved value even during shrink distribution. Resolved against the parent height at solve time. A zero-value ScyllaUILength imposes no constraint.
Declaration
public ScyllaUILength MinHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| ScyllaUILength |
MinWidth
Hard lower bound on this child's width. The solver never allocates less than the resolved value even during shrink distribution. Resolved against the parent width at solve time. A zero-value ScyllaUILength imposes no constraint.
Declaration
public ScyllaUILength MinWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| ScyllaUILength |
PreferredHeight
Explicit preferred height for this child. When non-zero, overrides the child's
intrinsic ILayoutElement.preferredHeight or its RectTransform
rect height during measurement. Resolved against the parent height at solve time.
Declaration
public ScyllaUILength PreferredHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| ScyllaUILength |
PreferredWidth
Explicit preferred width for this child. When non-zero, overrides the child's
intrinsic ILayoutElement.preferredWidth or its RectTransform
rect width during measurement. Resolved against the parent width at solve time.
Declaration
public ScyllaUILength PreferredWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| ScyllaUILength |
ShrinkWeight
Proportional share of negative free space on the main axis when the stack is
over-allocated. The solver weights each child's shrink contribution by
ShrinkWeight * preferredSize, so heavier or larger children shrink more.
A weight of 0 prevents the child from shrinking below its preferred size.
Negative values are clamped to 0.
Declaration
public float ShrinkWeight { get; set; }
Property Value
| Type | Description |
|---|---|
| float |