[SyncVar] Protect from Cheat Engine

Hello everyone,
Is there any solution to protect [SyncVar] from Cheat Engine?
for example:

[SyncVar(hook = "OnMoneyChange")]
    public float money = 500.0F;

public void OnMoneyChange(float updateMoney){
        money = updateMoney;
    }

If I use Cheat Engine, it easy to change it and then buy something for example in my if money < itembuyprice

if(money < itembuyPrice){
                inventory.DontAllowBuy();
                }

with this you can bypass that if, your SyncVar goin to “-” float, like -500$, but the Cheat Engine shows 100000$ and allow to buy.
Thank you

A cheat engine will change the value of the variable on local machine, however it can’t affect the value on server, so if you make the buy operation on server, regardless of what shows local machine the variable will be true one on server.
SyncVar syncs the variables from server to client (single direction only).

1 Like

thank you for your suggestion, I will try.

have you any ideas how to do buy on Server Side?

It really depends on how you’re writing your code and your DB backend can affect this process too, there’s no standard way to do it so can’t really help much.
All I can say is that you can use command or networkMessage to send the buy request, on server you validate the request then perform it and send RPC/networkMessage with the operation state (success/failed)

1 Like

Go It! Thank you so much for your help!