Class HostedChildManager
Owns the remount-on-show lifecycle of a composite's hosted children (shared view instances, e.g. menus): registration, mounting (reparent in + prepare) on show, releasing (restore + reparent back) on hide, and reacting to a mounted view re-measuring itself. Extracted from UnityCompositeUiView so the hosting rules are a single testable collaborator the factory wires up, rather than view internals.
Inherited Members
Namespace: Serenity.Ui.Infrastructure.Views
Assembly: Serenity.UnityUi.Infrastructure.dll
Syntax
public sealed class HostedChildManager
Constructors
HostedChildManager(Func<Transform>, IHostedSizeApplier, Action)
Creates the manager over its host composite's mounting context.
Declaration
public HostedChildManager(Func<Transform> contentRoot, IHostedSizeApplier sizeApplier, Action onHostedResized)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<Transform> | contentRoot | Provides the transform hosted children are mounted under (deferred — the root is built after the view). |
| IHostedSizeApplier | sizeApplier | Re-reserves an auto-sized hosted child's slot when it re-measures. |
| Action | onHostedResized | Invoked after a mounted child re-measures, so the owner can rebuild its scroll layout. |
Methods
Register(IViewBase, IHostableView, Transform, UiAnchorType, LayoutSize, bool)
Registers a hosted child for remount-on-show. The instance is left under
originalParent at build time and only reparented in when shown, then restored
and reparented back when hidden — so it is never trapped under an inactive composite and stays
usable on its own.
Declaration
public void Register(IViewBase child, IHostableView hostable, Transform originalParent, UiAnchorType viewAlignment, LayoutSize size, bool parentHorizontal)
Parameters
| Type | Name | Description |
|---|---|---|
| IViewBase | child | The hosted view instance. |
| IHostableView | hostable | The hosting hooks for |
| Transform | originalParent | The transform the view is parented under when not hosted (e.g. the canvas). |
| UiAnchorType | viewAlignment | Where the view is anchored within its slot while hosted. |
| LayoutSize | size | The CSS-style main-axis size declared for the child's slot. |
| bool | parentHorizontal | True when the owning composite's layout main axis is horizontal. |
TryHide(IViewBase)
Hides child if it is a registered hosted child: drives its real hide sequence
and releases it. A hosted child that is not currently mounted here is left alone, so hiding the
composite never hides (or steals) a shared instance that is being shown somewhere else.
Declaration
public bool TryHide(IViewBase child)
Parameters
| Type | Name | Description |
|---|---|---|
| IViewBase | child | The child being hidden. |
Returns
| Type | Description |
|---|---|
| bool | True when the child was hosted (and is handled); false when the caller should hide it directly. |
TryShow(IViewBase)
Shows child if it is a registered hosted child: mounts it and drives its real
show sequence (a bare GameObject activation alone would leave it invisible).
Declaration
public bool TryShow(IViewBase child)
Parameters
| Type | Name | Description |
|---|---|---|
| IViewBase | child | The child being shown. |
Returns
| Type | Description |
|---|---|
| bool | True when the child was hosted (and is now shown); false when the caller should show it directly. |