Skip to content

Systems and control APIs

The following APIs operate on existing components. Configure ownership/profiles first and use IsInitialized plus required module availability before issuing commands. They are Unity main-thread operations, not thread-safe simulation services.

Time (Sital.Tunal.Systems.TimeSystem)

Member Units, effect, limitations
CurrentTime, NormalizedDayTime, TotalDays Canonical time, normalized day fraction, elapsed-day index
DisplayTime, DisplayHoursPerDay Display representation; hours may exceed 23 only for simulated clocks
SetTime(int hour, int minute, int second = 0) Immediate canonical clock on current day; simulated-only; cancels transition
SetDisplayTime(int hour, int minute, int second = 0) Immediate display-clock input; simulated-only
SetSimulatedHoursPerDay(int hours) Clamps 1–48; presentation mapping, not day duration
SetRealSecondsPerGameMinute(float seconds) Real seconds per canonical minute; selects GameMinuteDuration
ConfigureSolarDay(double earthSecondsPerSol, float timeScale = 1) Positive finite physical duration/scale; selects SolarDayDuration
SetSolarDayTimeScale(float timeScale) Positive finite scale; selects SolarDayDuration
SetTimeMode(TimeMode mode) Source switch; follow with calendar reconciliation when applicable
SetUTCOffsetHours(float hours) −12…+14 fixed offset, not a timezone/DST database
SetPaused(bool paused) Affects simulated mode only
TransitionToTime(int,int,int,float) / TransitionToDisplayTime(int,int,int,float) Same-day target; duration in unscaled seconds; earlier target rewinds
TransitionBySeconds(double,float) and Minutes/Hours/Days variants Relative canonical movement; negative allowed
TransitionToElapsedSeconds(double,float) Absolute chronological target with representability/snap checks
CanTransitionToElapsedSeconds(double) Pre-check for active clock/calendar bounds
CancelTransition() Stops animation at current state

SetTimeSpeed has a historical game-minutes-per-real-second convention, not a universal physical-time multiplier. Prefer the explicit rate APIs above. Persistence-only restore/notify methods coordinate a larger operation; do not call them as a substitute for ordinary time setters.

Calendar and location

Component/member Contract
CalendarSystem.CurrentDate DateData day/month/year; constructor order is day, month, year
CalendarSystem.IsValidDate(DateData) Check before accepting user date input
SetDate(DateData) / SetDate(DateData,float) Uses configured/explicit duration; simulated-only; preserves time of day
SetCalendar(CalendarDefinition) / SetGregorian() Changes calendar mode and can rebase chronological configuration
RefreshAfterTimeModeChange() Reconciles calendar to selected source; may rebase anchors/elapsed days
AstronomicalSystem.SetLatitude(float) Degrees −90…90; refreshes state
SetLongitude(float), SetTimeZoneMeridian(float) Degrees −180…180; solar update depends on longitude-correction setting
SetUseLongitudeCorrection(bool) Enables/disables explicit solar-time correction
SetAstronomicalProfile(AstronomicalProfile) Replaces the source profile; not an ephemeris download

There is no AstronomicalSystem.SetLocation method in this checkout. The UI facade has a combined SetLocation convenience operation. Do not confuse the facade with the system API when writing examples.

Other systems

System Useful integration surface
Day Phase CurrentPhase, HasCurrentPhase, CurrentPhaseProgress, ResolvedPhaseRanges, CurrentPolarPaletteWeights, SetDayPhaseProfile
Seasons CurrentSeasonId, CurrentSeasonName, SeasonProgress, CycleProgress, Influences, GetSeasonInfluence, GetTrackInfluence, SetSeasonProfile, RevalidateProfileAndRefresh
Lunar CurrentPhase, LunarDirection, IlluminatedFraction, LunarCycleProgress, IsMoonAboveHorizon, SetLunarProfile

Check Day Phases, Seasons, and Lunar for semantic differences between discrete selections and continuous weights.

Context selection, UI, lifecycle, persistence

TunalContextSwitcher.SwitchToContext(index) returns false for invalid configuration/index or unavailable switching; SetContext(index) is its UnityEvent-friendly wrapper. Next/Previous cycle the configured list. onContextChanged publishes the selected context; it does not retarget arbitrary consumer objects automatically.

TunalPresentationGroup.SetContext(context) selects explicit presentation authority; ResetToParentContext() returns to automatic resolution. TunalUguiContext.SetPresentationGroup(group) selects view scope; TunalUIRuntimeController.SetContext(context) selects command scope without rewriting world persistence registration.

Lifecycle controls and their return values are documented in progression; persistence operations/results in context capture, world saves, and storage contracts. Prefer those high-level APIs over manually invoking individual serializer restore stages.