Skip to content

Runtime UI

Tunal's runtime UI is optional. TunalUIRuntimeController is a command facade for one selected simulation; TunalUguiContext resolves optional presenters in one assigned presentation group. Views display/control only the systems and presenters they can actually bind.

Add the supplied UI

  1. Instantiate GameObject > Tunal > UI > Tunal Canvas (uGUI), or locate the standard Canvas under Runtime/Prefabs/UI.
  2. Assign the intended Context on the runtime controller. Avoid the context-free fallback fields in a new integration.
  3. Assign Presentation Group on the uGUI context for visual controls. A non-null group's BoundContext is authoritative and can rebind the command controller.
  4. Keep an active EventSystem with an input module suitable for your project's input backend. Do not add a second competing EventSystem merely because UI is not responding.
  5. Enter Play Mode and check a time control first, then optional panels. Ready means Time is available, not that every module exists.

The generated text-backend metadata does not install TMP or provide a font. Start with standard UI unless you deliberately install the TMP variant.

Included view roles

Components Responsibility
TunalTimePanel, TunalScrubSlider, TunalUguiClockDisplay, TunalUguiTimeline Time mode/rate, display clock, scrubbing and timeline views
TunalCalendarPanel, TunalContextDateTimeSource Calendar navigation and formatted context date/time
TunalLocationPanel, TunalCelestialPanel, celestial/observer plots Observer controls and calculated celestial information
TunalCloudPanel, TunalLightingPanel Bound presentation appearance/lighting controls
TunalStatusHud, TunalSeasonIndicator, info cards Status/season/context displays
TunalPersistencePanel Selected context/world slot controls
TunalUguiContextSwitcher, TunalUguiContextOption Context-selection list and previous/next navigation
Text labels, slider readouts, panels, settings toggles, theme targets/selectable appearance Reusable view, display, and theme support

Use the supplied prefab wiring as a reference instead of assuming every panel creates its target system. Optional modules can leave controls unavailable. CanEditSimulation requires initialized Time in Simulated mode; an OS clock is not editable through a date/clock field.

Commands, load, and save mode

The facade exposes operations such as SetDisplayClock, SetDateTransitionDuration, SetLocation, and profile selection. Its clock-mode command coordinates calendar resynchronization. This is distinct from calling the lower-level Time setter yourself.

Single Context persistence acts on the selected context's persistence component. Whole World acts on the explicitly assigned WorldPersistence registry, even when the visible context changes. SetContext does not rewrite the world registry. Check CanPersist, IsSaving, result errors, and warnings before showing success.

The uGUI context exposes BeforeLoad and LoadVersion/NotifyLoaded for view coordination. Its Presentation Group is a scope, not a request to scan the whole scene. After changing a presenter hierarchy, use RefreshPresentationReferences() when needed.

For multi-context setups, bind both command and presentation references as described in UI context switching. For custom UI you may use the command facade without the supplied views.