1

so I am trying to protect my game from memory scanners without using a server the protection doesn't need to be 100% but I want to try and protect them from most of the cheats I have an idea to try and change the address of the variable once a few seconds or maybe even on the onUpdate method but I don't know how to do that on the code without breaking the game, I know that has to be possible since there are some add-ons in the unity store that gives you classes like ProtectedInt that are like the original data types but can't be detected by software like cheat engine I can buy the addons but I wanna try to do without buying it..

is there another way I can protect my variables is my idea is possible to do without breaking or losing the value of the variable?

Nort721
  • 21
  • 1
  • 5
  • Welcome to SO. This is a very broad question, which I don't think only has one answer. I would recommend starting from the other side, and asking yourself : how to people use cheat engines and what do they do? Once you understand that, you can then attempt to prevent it. – WynDiesel Sep 14 '18 at 10:43
  • well I actually know how cheat engine works pretty well because I have used this software my self for a few years for some games like stick war and before a few days I have created a unity project that I have created to test some ideas that I hade after that i have exported the project and try using cheat engine on it but things got messy and i am still searching for a better method – Nort721 Sep 14 '18 at 10:48
  • I guess the best thing would be encrypting the data, you can have an object to ecapsulate the variable and never never store the original value, just store the encrypted value and return the decrypted value – LordCaos Oct 25 '20 at 12:42

2 Answers2

0

You might try using Windows Data Protection API exposed in .NET through System.Cryptography.ProtectedMemory, quick tutorial can be found here. Another writeup of the method includes a relevant note about copies of the unencrypted array being left in memory as a result of garbage collector defragmentation process.

General approach to protect different objects in your application would involve using binary de/serialization into an array, which you would then protect using the above method. Check out this answer to see how to do that. Once you have MemoryStream, use its method ToArray() to get the array.

grepfruit
  • 181
  • 9
0

This is a simple little tutorial on protecting variables, prefs and such. Utilizing ILSpy for validation. It's a great read. At the least you should install ILSpy.

https://www.alanzucconi.com/2015/09/02/a-practical-tutorial-to-hack-and-protect-unity-games/

jiveturkey
  • 2,484
  • 1
  • 23
  • 41