Class UnityCascadePanel
Script on a theme's cascade-panel prefab (CascadeViewTemplate): one navigable column/level of a
cascade menu. The prefab authors the themed look (background, padding, fonts) and exposes a header slot
and an options container; the cascade renderer fills the container with the theme's submittable option
components and drives focus through each component's native highlight. Resizing/scrolling mirrors
UnityModalComponent: the options grow with the list and scroll once they exceed a visible count.
Namespace: Serenity.Menu.Infrastructure.Cascade.View
Assembly: Serenity.UnityMenu.Infrastructure.dll
Syntax
public sealed class UnityCascadePanel : MonoBehaviour
Constructors
UnityCascadePanel()
Declaration
public UnityCascadePanel()
Properties
OptionsRoot
The container option components are added to (used by the renderer for positioning).
Declaration
public RectTransform OptionsRoot { get; }
Property Value
| Type | Description |
|---|---|
| RectTransform |
Methods
AdaptWidth(float, float)
Sizes the panel to fit the longest option/header on one line, clamped to [minWidth, maxWidth]. Labels that still do not fit at maxWidth are allowed to wrap. Call after SetOptions(IReadOnlyList<UnityUiInteractableComponent>) and before ConfigureScroll(bool, int). Returns the applied width (used to lay out adjacent columns).
Declaration
public float AdaptWidth(float minWidth, float maxWidth)
Parameters
| Type | Name | Description |
|---|---|---|
| float | minWidth | Lower clamp. |
| float | maxWidth | Upper clamp. |
Returns
| Type | Description |
|---|---|
| float | The width applied to the panel. |
ConfigureScroll(bool, int)
Clamps the options area to the first visibleCount options behind a scroll mask when
scrolling is enabled and there are more options than fit; otherwise the panel simply grows. Lifts the
vertical case of UnityModalComponent.ConfigureOptionsScroll.
Declaration
public void ConfigureScroll(bool scrollable, int visibleCount)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | scrollable | Whether scrolling is allowed for this panel. |
| int | visibleCount | How many options are visible before scrolling (ignored when <= 0). |
EnsureSelectedVisible(int, int)
Scrolls the options so the focused option stays inside the masked viewport (no-op without scroll).
Declaration
public void EnsureSelectedVisible(int index, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | Zero-based index of the focused option. |
| int | count | Total option count. |
SetInteractable(bool)
Dims and disables interaction on a non-top (breadcrumb) level via a CanvasGroup, like the procedural renderer did. The top level stays fully lit and interactable.
Declaration
public void SetInteractable(bool interactable)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | interactable | True for the focused (top) level; false dims this panel. |
SetOptions(IReadOnlyList<UnityUiInteractableComponent>)
Parents the given option components into the options container and rebuilds the layout, so the panel grows to fit them. Any authored placeholder children are removed first.
Declaration
public void SetOptions(IReadOnlyList<UnityUiInteractableComponent> options)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<UnityUiInteractableComponent> | options | The themed option components to display, in order. |
SetTitle(string)
Sets the header text, hiding the header holder when the title is empty.
Declaration
public void SetTitle(string title)
Parameters
| Type | Name | Description |
|---|---|---|
| string | title | The header text (already localized by the caller). |