> For the complete documentation index, see [llms.txt](https://apex-studio.gitbook.io/apex-secure-vault-official-documentation./llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apex-studio.gitbook.io/apex-secure-vault-official-documentation./anti-cheat-data-types-memory-protection.md).

# Anti-Cheat Data Types (Memory Protection)

One of the biggest vulnerabilities in offline and single-player games is memory editing. Hackers use tools like Cheat Engine (PC) or GameGuardian (Mobile) to scan the device's RAM, locate standard variables (like gold, health, or premium currency), and alter them maliciously.

Apex Secure Vault neutralizes this threat completely with our built-in, custom data types: ApexInt and ApexFloat.

#### Step 4.1: How They Work

Under the hood, ApexInt and ApexFloat utilize dynamic XOR cryptographic obfuscation. Every time a value is modified or read, a new random cryptographic key is generated to scramble the data in the RAM. If a hacker tries to scan the memory for a value of "100" coins, they will find nothing but randomized gibberish.

#### Step 4.2: Implementation & Math Operations

We have overloaded all standard math operations (+, -, \*, /, ++, --) and implicit conversions. This means you can drop ApexInt and ApexFloat right into your existing code without rewriting your game logic!

```c#
using UnityEngine;
using ApexStudio.ApexSecureVault;

public class PlayerWallet : SaveableObject
{
    [Header("Secure Currencies")]
    
    [SaveState] // Saves seamlessly to the encrypted vault
    public ApexInt premiumGems = 100; // Fully protected in RAM!
    
    [SaveState]
    public ApexFloat movementMultiplier = 1.5f;

    private void RewardPlayer()
    {
        // Standard math operations work perfectly out-of-the-box
        premiumGems += 50; 
        premiumGems++;     
        
        movementMultiplier *= 1.2f;

        // Implicitly converts back to standard types when needed (e.g., UI Text)
        int currentGems = premiumGems; 
        Debug.Log("Total Gems: " + currentGems);
    }
}
```

#### Step 4.3: Seamless Inspector Integration

Despite being heavily encrypted in the background, we have engineered ApexInt and ApexFloat to remain fully visible and editable within the Unity Inspector. Your game designers can tweak values easily without worrying about the underlying cryptography.

<figure><img src="/files/v8UCYz6TJ83llgIcW1KU" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://apex-studio.gitbook.io/apex-secure-vault-official-documentation./anti-cheat-data-types-memory-protection.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
