Can a player change (int, string, float etc....) from outside the game?

Hello

Lets say i have this code

int MonsterDamage=2500;

Can a player cheat and change that value by using a software or anything outside the game?

I know if it is PlayerPrefs then he can change it but what about (int, string, float etc…)?

It is possible to do this at runtime using a tool like Cheat Engine. However, depending on how and where the number shows up in code, finding the correct memory address(es) can be quite difficult and time consuming. Furthermore, if the game is multiplayer, it could only affect any servers/clients running on that machine.

It will always be theoretically possible to hex edit the appropriate bytes in the files of a build, but this is many times more difficult than the above.

Yes he can, using tool’s that can find and modify memory where your variable is stored. For example Cheat Engine, link here.

You can have a XML file, TXT file or any other kind of format that can be opened and edited hold the values, and make the game open this file at game start (or whenever you want) and read the data from it and assign it to any variables you wish.

Look up System.IO and general txt file writing for C#.

If you question aims at asking how to prevent cheating, then no, if you don’t go out of your way to give him the means to do so, a player won’t be able to change values.