• Hello
Search Results for

    Show / Hide Table of Contents

    11 - Protecting a desktop build (Pro)

    Goal: You will learn how to notice a debugger, a mod loader, a virtual machine, an unexpected install source, or a second copy of your game on Windows, macOS, and Linux.

    This guide needs the Pro version.

    The problem

    On a desktop computer the player controls everything around your game. They can:

    • attach a debugger, a tool that can pause the game and read or change it,
    • use a mod loader, a tool that adds other people's code to your game,
    • run the game inside a virtual machine, a computer simulated by software, where it is easier to inspect or automate,
    • copy the game folder and pass it around outside the store,
    • start the game twice on the same computer, so one copy can help the other in a multiplayer game.

    That hurts your game. Values get changed, cheats get loaded as mods, and copies run that nobody paid for.

    Many of these tools start before your scripts run. Anti-Cheat cannot block them. It can notice them, so you can react.

    The solution

    Four detectors cover this. Each step below is one of them. You can use one, some, or all.

    Detector prefab What it notices
    Desktop Environment Cheating Detector A debugger and a virtual machine
    Desktop Mod Loader Detector Mod loaders such as BepInEx or MelonLoader
    Install Source Detector An install from a store you do not allow
    Desktop Instance Lock Detector A second copy of the game running on the same computer

    Step 1: Make sure the detectors are there

    The predefined Anti-Cheat-Monitor prefab already includes all four. If you use it, you have nothing to do here.

    If you use your own monitor prefab, add the detector prefabs you want to it. Drag them onto the monitor in your prefab so they become children.

    Image 1: The detector prefabs in Assets/GUPS/AntiCheat/Resources/Prefabs/Detectors.

    The settings for all checks are in Edit > Project Settings > GuardingPearSoftware > AntiCheat, on the Desktop tab.

    Note

    Verify development builds is off by default. While it is off, these checks skip the Unity Editor and development builds. Leave it off while you work. The Editor itself can look like a debugger.

    Step 2: Debuggers

    Go to Desktop - Debugger - Settings.

    Image 2: The desktop debugger settings.

    Setting What it does
    Detect user-mode debugger Finds a normal debugger attached to the game, such as Visual Studio, dnSpy, or x64dbg. Works on Windows, macOS, and Linux. On by default
    Detect kernel-mode debugger Finds a debugger that works deep inside the operating system. Works on Windows only. On by default
    Report managed-only debugger Also reports when only Unity's own script debugger is attached. On by default

    A kernel-mode debugger adds much more to the threat score than a normal one.

    Details: Debugger.

    Step 3: Mod loaders

    Go to Desktop - Mod Loader - Settings.

    Image 3: The mod loader settings.

    Setting What it does
    Detect mod loaders Turns the check on. On by default
    Assembly name prefixes Names of code files a mod loader brings along
    File / folder names Files and folders a mod loader puts next to your game
    Hijack DLL names Library files a mod loader uses to get into your game

    The shipped lists cover the common loaders, such as BepInEx, MelonLoader, and Unity Doorstop. You can add your own entries.

    Note

    If your game supports mods on purpose, turn this check off.

    Details: Mod loader.

    Step 4: Virtual machines

    Go to Desktop - Virtual Environment - Settings.

    Image 4: The virtual machine settings.

    Setting What it does
    Detect virtual machine Turns the check on. On by default
    MAC OUI prefixes Network adapter ids that belong to virtual machines
    BIOS keywords Words in the system information that point to a virtual machine
    Windows service keys Windows services that a virtual machine installs

    The shipped lists cover hosts such as VMware, VirtualBox, Hyper-V, QEMU, and Parallels. You can add your own entries.

    Warning

    Developers, testers, and cloud players often use a virtual machine on purpose. Do not close the game on this check alone. Flag the session, or use a soft reaction.

    Details: Virtual machine.

    Step 5: Install source

    A copied build often does not come from the store you sell on. This check reads which store the running game was installed from.

    Go to Desktop - App Store - Settings.

    Setting What it does
    Allow all installation sources On: every source is allowed and nothing is reported. Off: only the stores below are allowed. On by default
    Allow following sources The stores you trust: Steam, Epic Games, GOG, Microsoft Store, or Unknown

    Turn Allow all installation sources off and tick the stores you ship on.

    • Steam, Epic Games, and GOG are found on Windows, macOS, and Linux.
    • The Microsoft Store, including Game Pass for PC, is Windows only.
    • Unknown is a direct download or a store the check does not know. Allow it when you also ship outside those stores.

    This check does not run inside the Unity Editor. It works in Unity 6 and newer.

    Details: Install source.

    Step 6: A second copy of the game (optional)

    In a multiplayer game, a second copy on the same computer can be used to cheat. One copy plays, and the other feeds it information or farms rewards. The Desktop Instance Lock Detector notices that second copy.

    Go to Desktop - Instance Lock - Settings.

    Setting What it does
    Lock to a single instance On: a second copy of this game on the same computer is reported. Off by default

    Turn it on only when a second copy is a problem in your game. Local co-op may start a second copy on purpose, and that is harmless.

    A few things to know:

    • The first copy runs as normal. The second copy is the one that reports.
    • Two copies count as the same game when they have the same company name and product name, even from two different folders.
    • The check runs once, when the game starts.
    • The game is not closed. You decide what happens.

    A common reaction is to show a message and close the second copy:

    var detector = AntiCheatMonitor.Instance.GetDetector<DesktopInstanceLockDetector>();
    
    if (detector != null && detector.ManualScan())
    {
        // Another copy of the game is already running.
        Application.Quit();
    }
    

    Details: Instance lock.

    The result

    • A debugger or a mod loader raises the threat score of the Anti-Cheat Monitor.
    • A virtual machine raises it only a little. Treat it as a maybe, not as proof.
    • An install source you did not allow raises it too. On a desktop that sign is weaker than on Android or iOS, most of all when the source is Unknown.
    • A second copy of the game raises it, once you turned that check on.
    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: Debugger, Mod loader, Virtual machine, Install source, and Instance lock.

    Next steps

    • Protecting memory against Cheat Engine protects the values a debugger tries to change.
    • Punishing cheaters shows how to react automatically.

    Next guide: 12 - Reacting to detected cheating.

    Back to the Guides overview.

    In This Article
    Back to top GuardingPearSoftware documentation