Skip to content
Version 2.11.0
↓ Get the launcher

IFrameworkTiming interface

Timing / main-thread-marshalling surface of IFramework. Split out from the frame/screen metrics so each interface stays within the framework’s shape budget; consumers reach these through services.Framework exactly as if they were declared on IFramework.

public interface IFrameworkTiming
name description
TimeNow { get; } Monotonic seconds since framework start. Backed by a process stopwatch — it never reads UnityEngine.Time, so it cannot throw the IL2CPP “get_realtimeSinceStartup can only be called from the main thread” exception and is safe to read from any thread. Use for relative timing only (the epoch is arbitrary).
Every(…) Registers a recurring callback fired at most once per interval, downsampled from this plugin’s Update tick (so it never runs faster than the plugin ticks). Dispose the returned scope to cancel. Replaces the hand-rolled _accum += dt; if (_accum >= period) idiom.
Post(…) Queues action to run once on the next Update tick of this plugin. Thread-safe: the marshal is the supported way to hop work collected on a background thread (chat/network callbacks) onto the Unity main thread before it touches the game.