Interface ILunyTimeService
Provides engine-agnostic access to time and frame information.
public interface ILunyTimeService : ILunyEngineService
Remarks
IMPORTANT: Implementations must inherit from both the ILunyService interface and its corresponding LunyServiceBase class!
Properties
DeltaTime
Time since last frame update. Updates once after heartbeat. Value varies with framerate.
double DeltaTime { get; }
Property Value
- double
Remarks
When read in a Heartbeat method, be aware that DeltaTime is last frame's deltaTime.
ElapsedSeconds
Gets the time in seconds since the application started. Uses real time (not affected by Time.timeScale).
double ElapsedSeconds { get; }
Property Value
- double
EngineFrameCount
Gets the engine's frame count since the application started.
long EngineFrameCount { get; }
Property Value
- long
Remarks
CAUTION: This value may differ between engines! Some engines start with frame 0, others in frame 1. Unity for instance launches in frame 0 where it runs Awake and OnEnable, but by Start it has incremented FrameCount to 1. While in Godot the entire first frame's FrameCount is 0. Prefer FrameCount since it is the same for all engines.
FixedDeltaTime
Time between two heartbeats. Value remains fixed (constant) at runtime.
double FixedDeltaTime { get; }
Property Value
- double
FrameCount
Gets the total number of frames LunyEngine has run since launch. This value is consistent across engines.
long FrameCount { get; }
Property Value
- long
Remarks
Initialization (startup, OnCreate, OnEnable) occurs in FrameCount 0. By OnReady (and before first OnHeartbeat/OnFrame) FrameCount will be 1.
HeartbeatCount
Gets the total number of heartbeats LunyEngine has run since launch. This value is consistent across engines.
long HeartbeatCount { get; }
Property Value
- long