Someone recently took my code from a Unity project I made. I would like to know how to prevent this. I found this: Is there a way to reverse engineer a built project. - Questions & Answers - Unity Discussions, and I was wondering how to stop this from happening in the future.
Thanks.
The only way to stop people from decompiling your code would be to not publish your game.
What is the worry with people “stealing” your code though? What are you afraid they will do with it?
1 Like
The linked answer is for a build using Mono. Use IL2CPP if available for your target platform and the process of getting back to your original code will be considerably more difficult (not impossible, but there aren’t any script kiddie tools to do it either).
The difference is using Mono your C# code is compiled to IL instead of machine code. This is the normal way C# has been compiled since the language was first created. IL is converted to machine code at runtime instead of during the build process. IL is trivial to convert back to C# with the correct tools.
IL2CPP by contrast goes further and converts the IL into C++ and then compiles the C++ code to machine code. So no IL is handed out with your IL2CPP build. Machine code is considerably more difficult to convert back to C# compared to IL.
2 Likes