04 - Protecting against speedhacks (Pro)
Goal: You will learn how to stop players from speeding up or slowing down your game with tools like Cheat Engine Speedhack, and how to keep movement and timers fair with ProtectedTime.
This guide needs the Pro version.
The problem
Not every cheat edits coins or health. Many players simply speed the whole game up. A speed hack, such as the Speedhack in Cheat Engine, makes the game clock run faster or slower. At a factor of 25, cooldowns end at once and movement becomes far too fast. Any code that uses UnityEngine.Time.deltaTime now works in the cheater's favor.

Image 1: Cheat Engine with Speedhack on and the speed set to 25, twenty-five times the normal game speed.
In the game, the player flies across the level.

Image 2: The result in the game. The player character races across the platforms.
The solution
Use Anti-Cheat ProtectedTime in place of UnityEngine.Time. Two parts then do the work:
- The Game Time Monitor compares Unity's clock with a real-time clock that a speed hack does not change as easily.
- The Game Time Cheating Detector decides if the difference is a speed hack. It reports it and keeps
ProtectedTimeon real speed.
Step 1: Know what depends on game time
Anything that uses Time.deltaTime, Time.time, or similar values is affected by a speed hack:
- Movement and animation: Walk, run, jump, and projectile speeds become unfair.
- Cooldowns and skill timers: Abilities recharge in a fraction of a second.
- Spawning and waves: Enemies or resources appear much too early.
- Match or level timers: The cheater finishes faster than honest players.
You do not need to replace every use of Time. Protect the timing that decides fairness.
Step 2: Replace UnityEngine.Time with ProtectedTime
ProtectedTime has the same properties as Unity's Time. Change the type, and your movement and timers read the protected clock.
A simple mover before:
using UnityEngine;
public class PlayerMover : MonoBehaviour
{
public float speed = 5f;
private void Update()
{
// Unity's clock: easy to speed up.
transform.Translate(Vector3.right * speed * Time.deltaTime);
}
}
And after:
using UnityEngine;
using GUPS.AntiCheat.Protected.Time;
public class PlayerMover : MonoBehaviour
{
public float speed = 5f;
private void Update()
{
// The protected clock: stays on real speed.
transform.Translate(Vector3.right * speed * ProtectedTime.deltaTime);
}
}
ProtectedTime has deltaTime, fixedDeltaTime, time, timeScale, unscaledDeltaTime, unscaledTime, realtimeSinceStartup, and timeSinceLevelLoad.
Step 3: Make sure the detector is there
ProtectedTime needs the Game Time Cheating Detector and its Game Time Monitor. Without them, nothing is compared and nothing is corrected.
The predefined Anti-Cheat-Monitor prefab already includes both. If you use it, you have nothing to do here.
If you use your own monitor prefab, add the Game Time Cheating Detector prefab to it. It holds the detector and the monitor together. Drag it onto the monitor in your prefab so it becomes a child.

Image 3: The detector prefabs in Assets/GUPS/AntiCheat/Resources/Prefabs/Detectors.
Note
The monitor and the detector must be on the same GameObject. The prefab already sets this up.
Step 4: Set up the monitor and the detector
Select the Game Time Cheating Detector. The Inspector shows both components.

Image 4: The Game Time Cheating Detector in the Inspector.
On the monitor:
- Tolerance Factor: How far the game speed may drift from real time before it is reported. The default is 0.25. That reports 1.25 times and faster, or 0.75 times and slower.
On the detector:
- Is Active: Turns the detector on or off.
- Possibility Of False Positive: How likely a find is a false alarm. The default is 0.25, because an uneven timer can look like a speed hack for a moment.
- Threat Rating: How much one find adds to the threat score of the Anti-Cheat Monitor. The default is 45. That is low, because a speed hack is reported again about every 2.5 seconds while it stays on. The score adds up quickly.
- Detect Delta Time Cheating: Finds a sped up or slowed down game clock. This is the usual speed hack. Leave it on.
- Detect Fixed Delta Time Cheating: Off by default. Turn it on if cheaters skip physics by changing
fixedDeltaTime. While it is on, change that value only throughProtectedTime.fixedDeltaTime. Any other change is treated as a cheat and put back. - On Cheating Detection Event: Your own reactions. Assign a method here. You need no code for that.
You can also 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.
Step 5: Try it
Open the demo scene Assets/GUPS/AntiCheat/Demos/Demo_GameTime/Scene.unity. It shows a clock. Speed it up with a speed hack tool, once without and once with Anti-Cheat. The demo folder has its own ReadMe.
The result
With ProtectedTime in your gameplay code and the Game Time Cheating Detector running:
- A speed hack set to 25 no longer gives the player fast movement and instant cooldowns in code that uses
ProtectedTime. ProtectedTimestays on real speed while the hack is on. It does not jump when the hack changes or turns off.- The detector reports the cheat about every 2.5 seconds while the hack stays on.
- Changing
Time.timeScaleis not treated as cheating. Slow motion and pause still work.
Note
The predefined monitor prefab has no punisher. A find raises the threat score, but nothing more happens to the player until you react yourself or add a punisher.
Settings reference: Protected Game Time, Game time monitor, and Game time detector.
Next steps
- Reacting to detected cheating shows how to run your own logic when a speed hack is found.
- Punishing cheaters shows how to react automatically.
Next guide: 05 - Protecting against device clock cheating (Pro).
Back to the Guides overview.