Table of Contents

Class UnityTimeService

Namespace
Luny.Unity.Engine.Services
Assembly
Luny.Unity.dll

Unity implementation of time service. Uses Unity's Time.frameCount and Time.realtimeSinceStartupAsDouble for cross-platform consistency.

public sealed class UnityTimeService : LunyTimeServiceBase, ILunyTimeService, ILunyEngineService
Inheritance
object
UnityTimeService
Implements
Inherited Members

Constructors

UnityTimeService()

public UnityTimeService()

Properties

ElapsedSeconds

Gets the time in seconds since the application started. Uses real time (not affected by Time.timeScale).

public override double ElapsedSeconds { get; }

Property Value

double

EngineFrameCount

Gets the engine's frame count since the application started.

public override 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.

Methods

OnServiceInitialize()

protected override void OnServiceInitialize()

OnServiceShutdown()

protected override void OnServiceShutdown()

OnServiceStartup()

protected override void OnServiceStartup()