Protected Game Time (Pro)
Many games use Time.deltaTime for movement and cooldowns. A speed hack is a tool that makes that clock run faster or slower. ProtectedTime gives you a clock that stays on real speed.
Protected game time needs the Pro version.
Walkthrough: Protecting against speedhacks.
How to use
Replace UnityEngine.Time with ProtectedTime. The names match.
Before:
transform.position += velocity * Time.deltaTime;
After:
using GUPS.AntiCheat.Protected.Time;
transform.position += velocity * ProtectedTime.deltaTime;
What ProtectedTime offers
| Property | What it is |
|---|---|
deltaTime |
Seconds the last frame took |
unscaledDeltaTime |
The same, without timeScale |
fixedDeltaTime |
Seconds between two physics steps. You can set it |
time |
Seconds since the game started |
unscaledTime |
The same, without timeScale |
timeSinceLevelLoad |
Seconds since the last scene was loaded |
realtimeSinceStartup |
Real seconds since the game started |
timeScale |
The speed of game time, for slow motion or pause. You can set it |
Do you need to add the detector?
ProtectedTime needs the GameTimeCheatingDetector and its GameTimeMonitor. The monitor measures how fast the game clock really runs. The detector decides if that is a speed hack and keeps ProtectedTime on real speed.
Most of the time you have nothing to do. The predefined Anti-Cheat-Monitor prefab already includes both.
If you use your own monitor prefab, drag the Game Time Cheating Detector prefab onto the monitor in your prefab so it becomes a child. It holds the detector and the monitor together.

The detector prefabs in Assets/GUPS/AntiCheat/Resources/Prefabs/Detectors.
Settings: Game time monitor and Game time detector.
Good to know
ProtectedTimestays on real speed while a speed hack starts, changes, or stops. It does not jump when the hack ends.Time.timeScaleis not treated as cheating. Slow motion and pause still work.ProtectedTime.timeScalesimply passes the value on.- If you turn on the fixed delta time check on the detector, change the physics step only through
ProtectedTime.fixedDeltaTime. Any other change is put back. - You do not need to replace every use of
Time. Protect the timing that decides fairness.
React to a speed hack
Ask the detector in code:
var detector = AntiCheatMonitor.Instance.GetDetector<GameTimeCheatingDetector>();
if (detector != null && detector.PossibleCheatingDetected)
{
// The game clock runs too fast or too slow right now.
}
This flag turns off again when the clock looks normal.
More ways to react: Reacting to cheating.
Back to the Protected overview.