I know that anyone with enough time and skill will always be able to read the code from your game and that is not something I really worry about.
My issue is that my game is very story driven and there are some puzzles that players are supposed to be stuck for a long time, and if you are able to read the code, you can solve them pretty fast…
So the only thing I really need is for variable names to be scrambled in a way they don’t make sense if someone decompiles the Assemblies with a tool like ILSpy (which would take like 5 minutes of effort).
After that, if someone digs further than I don’t really care.
Is this possible? Any suggestions? Would it even be possible to do in the source code, rather than the assemblies? Does Unity provide any protection for this?
Is the game single player? Is there a leaderboard? If there is no leaderboard, then logically speaking there isn’t much of a reason to protect against cheaters like that.
The majority of people don’t know how to decompile .NET or Mono assemblies anyway, so that’s okay.
Also, when you compile C# via Mono or .NET, the IL code that is generated is basically already obfuscated, and it becomes very very difficult to read it. Variable names are almost always very weird and the only way to actually figure out what code is doing what is to read it - ALL OF IT.
So, in short: don’t worry! Its highly unlikely that anyone will manage to solve your puzzles via cheating. Besides, someone might post the solution online and someone else might use that solution. You can’t protect against that (usually).