Prevent users from opening external data files

I am creating ‘external’ scripts for my unity game where the scripts are in a file diretory for the game. The main reason these files are external is so that I will be able to release updates for my game but the users will still have saves and presets from previous updates.

These scripts will mainly be save files and graphics presets for the user however I do not want the users to be able to open or edit the files outside of the game to prevent errors within the game.

You can obfuscate what the information is and/or encrypt what is in the files, but be aware that all these do is slow determined players down. If someone really wants to take apart the file, they will. I’ve played more than one game where someone had figured out how to take a hex editor in and adjust save games or other files. Ultimately, if you’re worried about the data, what you’re shooting for is making it not easy.

Just keep in mind that you have to balance that protection with both how much effort the game has to put in for encrypting and decrypting the data, plus the risk of data being corrupted when it is put in or taken out of the file.

Use encryption to store the files. A simple example for this task:

Encryption/Decryption Example

This is by no means NSA-save. But for the casual user of your game it should be enough.