1. Home
  2. Docs
  3. Anti Cheat
  4. How to start
  5. Pro

Pro

Step 1:

After importing the Anti Cheat packet, open ‘Assets/OPS/AntiCheat/Prefabs’. Here you find the AntiCheat prefab. Place it in the first scene. (The scene with the number 0, defined in your build settings.) The AntiCheat prefab activates the hacking detectors.

Step 2:

To attach to the detectors activated in step 1, open your programming environment. Create an Detector class ( for example have a look at the DetectorsDemo ). The best is to create an MonoBehaviour and add it to some GameObject in your first scene too, while attaching a DoNotDestroyBehaviour too, so the GameObject wont be destroyed when you switch a scene.

Step 3:

To auto protect your fields, player prefs and time, go to Windows->Anti Cheat Settings and activate the specific settings. The auto protection will while building your game, replace the fields in your class through protected ones just like the player prefs and time (for example Time.deltaTime).

To auto protect fields you have to attach the ‘OPS.AntiCheat.Attribute.ProtectField’ Attribute.

For example:

The marked fields getting auto protected while build time. Another advantage of auto protection is the compatibility to Network Systems. Because Network Systems manipulate the build assembly, for example Unitys Unet using the SyncVar Attribute, to make them network ready. Auto Protection recognizes this and makes the protected fields network ready.

Step 4 (Customize protection):

If you do not want the auto protection, you can sure protect everything by yourself. Start with protecting the fields. To do this, replace your normal used fields through protected one and use them like you used your fields before.

Possible Operations with Protected Field Types:

Step 5 (Customize protection):

The next step is to protect your PlayerPrefs. Just like in Step 4, add the Protected before PlayerPrefs and so use ProtectedPlayerPrefs instead of PlayerPrefs. Now your PlayerPrefs are protected against user manipulation.

Step 6 (Customize protection):

Protect your game time against manipulation by using ProtectedTime. ProtectedTime calculates based on the computer time, thread speed and cpu clock rate a custom time, save against manipulation through extern tools.

Replace UnityEngine.Time with OPS.AntiCheat.ProtectedTime.

Example: