Skip to content

LayoutComponent

Standalone Begin/End-driven component that arranges GameObjects in space.

Namespace: Jungle.Data Inherits: ControllableComponentMonoBehaviour

Overview

LayoutComponent pulls subjects from an ILayoutSubjectSource ("what to lay out"), pulls target slots from an ILayoutSlotSource ("where to lay out"), and snaps each subject's transform to its matching slot on Begin.

The execution-frame model is inherited from ControllableComponent: Begin/End fire from the configured IExecutionFrame (default: OnEnable/OnDisable) and can also be invoked manually via PerformLayout().

Properties

Property Type Description
subjects ILayoutSubjectSource What to lay out — the GameObjects this component will arrange.
slots ILayoutSlotSource Where to lay out — the slot transforms each subject will be snapped to.
origin Transform Reference transform passed to slot sources. Falls back to this component's transform when null.
applyScale bool If true, scale is written to localScale; if false, scale is left untouched.
OnLayoutBegin UnityEvent Fired before subjects are repositioned.
OnLayoutEnd UnityEvent Fired after all subjects have been repositioned.

Methods

Method Description
PerformLayout() Re-resolve subjects and slots and snap each subject to its slot. Safe to call manually.
ResolvedSubjects Read-only view of subjects resolved during the last PerformLayout call.
ResolvedSlots Read-only view of slots resolved during the last PerformLayout call.

See Also