Universal - Game Time - Monitor (Pro)
In Unity, frame-based calculations rely heavily on UnityEngine.Time.deltaTime. Unfortunately, this time calculation is vulnerable to manipulation by cheat or hacking tools that allow unwanted acceleration, deceleration, or interruption of your game. AntiCheat has introduced a way to counteract such time manipulation.
Monitor
To monitor the game time, AntiCheat has introduced the 'GameTimeMonitor', which can be found in the 'GUPS.AntiCheat.Monitor.Time' namespace. The monitor tracks the game time and notifies observers of time deviations (no deviation, paused, slowed down, sped up) using the 'GameTimeStatus' that may be caused by a cheater.
Monitor Status
On every Update callback, the monitor validates the possible game time deviation. After every validation, observers are notified with the 'GameTimeStatus'. This status has one property:
- Deviation: Represents the deviation of game time, indicating any time-related manipulations.
The 'Deviation' property can have the following values:
- None: No time deviation.
- Stopped: Indicates that time has stopped.
- SlowedDown: Indicates that time is slowing down.
- SpeedUp: Indicates that time is speeding up.
Supported Platforms
The monitor is available on all platforms.
Requirements
There are no requirements.
How To Use
The usage is quite simple: attach the 'GameTimeMonitor' to a child GameObject of the 'AntiCheat-Monitor' and set up the 'GameTimeCheatingDetector'.
Add Monitor Component
Add the 'GameTimeMonitor' MonoBehavior from the 'GUPS.AntiCheat.Monitor.Time' namespace to your 'AntiCheat-Monitor' GameObject, or better, to a child GameObject.

Add the 'GameTimeMonitor' as a Component.
The game time validation is performed with every Update callback of the MonoBehavior 'GameTimeMonitor'. During validation, the actual game time provided by Unity is compared to a calculated time based on the ticks of the device's operating system that have elapsed. Due to possible game-dependent CPU or memory allocation peaks, a tolerance value is used to validate deviations. This can be freely assigned by you in the monitor inspector view.
Every time a validation is done, a 'GameTimeStatus' is sent to observers (usually detectors next to the monitor) describing whether the game time was paused, slowed down, or sped up.
Detect Game Time Tampering
To react to the sent status and thus validate the calculated time deviations, you need a detector. To do this, use the 'GameTimeCheatingDetector', a detector designed to analyse the status sent by the 'GameTimeMonitor' and validate it for cheating.