A speed hack replaces the functions your Unity game calls to read the clock, so every timer in the game runs fast. Here is how Cheat Engine does that, and how a small second clock in C# detects it.
By Tim UhlottFounder|Last updated: November 30, 2026|14 minutes read
unitycheat engineanti cheat
A player opens Cheat Engine, ticks "Enable Speedhack", types 2.0, and presses Apply. Your 60 second cooldown is now over in 30 seconds, and the character runs twice as fast.This time the player did not have to find a value in memory. They changed how fast time passes for your game, and everything that uses time followed.On a PC you will not fully prevent this. But you can notice it with very little code, and once you notice it, you can react.Let us first look at what a speed hack really changes. Then we look at why Unity's own clocks cannot see it, and build a small second clock in C# that can.
What is a speed hack?
A speed hack makes a game believe that time passes faster or slower than it really does. The CPU does not get faster and the Windows clock in the taskbar stays the same, because only the game is lied to.The best known one is the Speedhack in Cheat Engine (opens in a new tab). The Cheat Engine wiki (opens in a new tab) describes it in one line: it "lets a user speed up or slow down a game".I covered speed hacks briefly in How Cheat Engine works, and what it actually does, with general deeper dives into Cheat Engine. This article stays with the speed hack.
How a game knows what time it is
A game does not know how much time has passed. Every frame it asks the operating system for the current time, then subtracts the previous frame's time from that. The result is the time between two frames. In Unity you know it as Time.deltaTime (opens in a new tab).On Windows, Unity uses one of the following functions to get the current time. The precise one is QueryPerformanceCounter (opens in a new tab), which Microsoft recommends for high resolution time stamps (opens in a new tab). The older ones are GetTickCount and GetTickCount64, which count milliseconds since the system started.Everything in your game that moves uses that result. A typical mover looks like this:
If the answer from the operating system is wrong, Time.deltaTime is wrong, and the player moves the wrong distance. Cooldowns, animations, spawn timers, and physics steps all follow.
Remember: Your game asks the operating system for the time, and it believes the answer.
How Cheat Engine changes the answer
Cheat Engine leaves the clock itself alone and changes the functions your game calls to read it.Cheat Engine injects a small DLL into your game process (speedhack-i386.dll or speedhack-x86_64.dll). Then it hooks the time functions. A hook redirects a function, so every call from your game lands in Cheat Engine's version first.The speedhack is open source, so we can read which functions get a replacement. In speedhackmain.pas (opens in a new tab) these are GetTickCount, GetTickCount64, and QueryPerformanceCounter.The replacement does a small calculation. The wiki gives the formula:
The base time is the moment the speed hack was switched on. From there, every real second is multiplied by the speed. Let us say the hack is switched on at second 10 with a speed of 2.0:
Real time
What the game is told
Real seconds since the hack
Seconds the game sees
10.0 s
10.0 s
0.0
0.0
10.5 s
11.0 s
0.5
1.0
11.0 s
12.0 s
1.0
2.0
12.0 s
14.0 s
2.0
4.0
After two real seconds, the game has been told that four seconds passed. Every frame still gets a steady delta time, so nothing in the game looks wrong. That delta is only twice as large as it should be.
Common questions about speed hacks
Does Time.unscaledDeltaTime help? No. Unscaled only means that Unity's own Time.timeScale is not applied. The value still comes from the same hooked functions.Does Time.realtimeSinceStartup help? No, for the same reason. The name sounds safe, but it is read from the operating system inside your process, and that is where the hook sits.What about a Stopwatch? No. The .NET documentation (opens in a new tab) says Stopwatch uses the high resolution performance counter when one is available. On Windows that is QueryPerformanceCounter, one of the hooked functions.Does FixedUpdate protect my physics? No. Unity runs as many fixed steps as fit into the time that passed. If the game is told that twice as much time passed, it runs twice as many physics steps per real second.Does IL2CPP or obfuscation stop it? No. Both change how your code looks, and the speed hack never reads your code. It changes a Windows function that your game calls.Is changing Time.timeScale the same thing? No. Time.timeScale is your own tool for slow motion and pause. A cheater can change it too, but that is a memory edit, and it is a different cheat.Does it work in multiplayer games? Only for things the client decides. If the server measures how far a player may move per second, a faster client clock only produces moves that the server rejects.
Takeaway: Every clock that Unity gives you is read inside your own process. A speed hack changes all of them at once, so you cannot find it by comparing two of them.
Count time without asking for the time
The hack only changes the functions that return the current time. So we count completed waits instead of reading the time.A way to do so is using a Sleep based clock. The thread calls a sleep function with 100 milliseconds. The Windows kernel does the waiting, outside of your process. No time value is returned that a hook could multiply. And the speedhack source has no replacement for the sleep functions.So we start a background thread that sleeps for 100 milliseconds, adds one to a counter, and repeats. Ten ticks are about one real second. In Update, we compare the time Unity reports with the ticks we counted.
usingSystem;usingSystem.Runtime.InteropServices;usingSystem.Threading;usingUnityEngine;publicclassSpeedHackCheck:MonoBehaviour{[DllImport("kernel32.dll")]privatestaticexternuintSleepEx(uint milliseconds,bool alertable);privateconstint IntervalMs =100;// One tick.privateconstint WindowTicks =10;// Compare about once per second.privateconstdouble Tolerance =0.25;publicstaticeventAction<double> SpeedHackDetected;privatelong ticks;privatevolatilebool running;privatelong lastTicks;privatedouble lastUnityTime;privatevoidAwake(){ running =true; lastUnityTime = Time.realtimeSinceStartupAsDouble;Thread thread =newThread(CountTicks); thread.IsBackground =true; thread.Start();}privatevoidOnDestroy(){ running =false;}// Runs on the background thread. It never reads a clock.privatevoidCountTicks(){while(running){SleepEx(IntervalMs,false); Interlocked.Increment(ref ticks);}}privatevoidUpdate(){long nowTicks = Interlocked.Read(ref ticks);long tickDelta = nowTicks - lastTicks;if(tickDelta < WindowTicks){return;}double unityNow = Time.realtimeSinceStartupAsDouble;double unityElapsed = unityNow - lastUnityTime;double realElapsed = tickDelta * IntervalMs /1000.0;// 1.0 is normal. 2.0 means the game runs twice as fast.double speed = unityElapsed / realElapsed;if(Math.Abs(speed -1.0)> Tolerance){ SpeedHackDetected?.Invoke(speed);} lastTicks = nowTicks; lastUnityTime = unityNow;}}
We call the Windows function SleepEx (opens in a new tab) directly instead of using Thread.Sleep. The direct call is one plain kernel wait, and we do not want to depend on how a runtime implements its own sleep. Note, this sample is for Windows builds only.Then we compare against Time.realtimeSinceStartupAsDouble and not against Time.time. That way your own slow motion and pause, which use Time.timeScale, are not detected as a cheat.The tolerance is wide on purpose. Windows does not wake a thread exactly on time, so a 100 millisecond sleep is often a few percent longer. We still count that tick as 100 milliseconds. Unity counts the extra wait, so the speed comes out a little above 1.0. With 0.25, everything between 0.75 and 1.25 counts as normal. I would not go below 0.1.
What the check sees
Let us run the numbers from the table again. The hack is set to 2.0 and we look at one window of ten ticks again:
Without speed hack
With speed hack at 2.0
Ticks counted
10
10
Real time from ticks
1.0 s
1.0 s
Time Unity reports
about 1.0 s
about 2.0 s
Speed
about 1.0
about 2.0
Result
normal
detected
The tick count stays at 10, because the sleep function is not hooked. Unity reports about 2.0 seconds. Divide Unity's 2.0 seconds by the 1.0 seconds from the ticks. The result is 2.0, the speed the cheater typed into Cheat Engine.Divide Time.deltaTime by that speed. Movement and timers then advance in real time, even while the hack is still running.
Takeaway: The tick counter never calls the hooked time functions, so the speed hack does not change it.
What does it cost?
Very little. It is one background thread that sleeps almost all the time, and it wakes up ten times per second to add one to a number. In Update it is one comparison per frame and one division per second.False alarms are the bigger cost. A PC that goes into standby, a debugger that stops the game, or a very long freeze can make one window look wrong. So I would not react to a single hit. Wait for a few bad windows in a row, and reset the two values when the game gets the focus back.
What this check does not stop
The check detects the common speed hack, and that is all it does.A cheater who reads your code can find the check and patch it out. A custom tool can hook the sleep function too, and then both clocks are wrong in the same way. The sample is for Windows, and other platforms need their own way to wait and to read time. And it does nothing against other cheats, such as edited memory or modded game code.But the player from the start of this article, with Cheat Engine and ticking the "Enable Speedhack" checkbox, is caught within about a second.What you do then is up to you. I would not ban on the first hit. Log it, correct the delta time, do not count the run for the leaderboard, or flag the save file.For anything that touches other players or real money, the answer is still the server. Let the server measure time for cooldowns, movement, and match results, and treat the clock of the client as a hint.
Conclusion
A speed hack works because your game asks its own process for the time, and Cheat Engine replaces the functions that answer.So do not trust Time.deltaTime alone, and do not expect unscaledDeltaTime, realtimeSinceStartup, or a Stopwatch to be safer. Add a second clock that counts time by waiting. Compare the two about once per second. React after a few bad windows, and keep multiplayer timing on the server.The script above is the idea in its smallest form, for Windows. But your game might also run on macOS, Linux, or mobile platforms such as Android and iOS. You also want a clock that keeps your gameplay at real speed after a detection. If you do not want to write and test all of that yourself, have a look at GuardingPearSoftware Anti-Cheat. It has a protected time class that you use in place of Unity's Time, and a detector that reports the speed hack.
00 views
00 shares
Discussion about this post
No comments yet. Be the first to start the discussion.