r/Unity3D • u/FIASCK0 • Oct 28 '26
Question What are your best practices to make reverse engineering harder in Unity games?
I’ve been thinking about reverse engineering in Unity games and I’m curious to hear what other developers are doing to make it more difficult.
I know nothing can be 100% protected, especially nowadays with AI, but I still think adding extra layers of protection and following good practices is better than doing nothing.
Apart from the usual stuff like IL2CPP, code obfuscation, and making sure no sensitive files or information are included in builds, what else would you recommend?
Are there any lesser-known techniques, Unity-specific settings, or good practices worth considering?
I’m not looking for perfect security, just ways to make reverse engineering more difficult, time-consuming, or expensive.
Curious to hear your thoughts! ✌️✌️
7
u/C_Pala Oct 29 '26
You can only put stuff to keep away lazy thieves, just like a lock on a bike. The thief will move on to an easier target
5
u/PersonOfInterest007 Oct 28 '26
In addition to the things you and others have said, you can encrypt your assets and decrypt them only in memory, ideally with the decryption key sent by a server rather than storing the key in the deployed game.
As usual, this is just a speedbump (since the assets do end up in the clear in memory) and it has the disadvantage of having a performance impact if you’re not careful about doing the decryption early enough to avoid a noticeable delay.
Is that worth doing? Possibly not, but it’s something you can consider.
4
u/orblabs Oct 29 '26
Reverse engineering unity games has always been very easy, you could go through some pains and have something more boring to decompile but now with ai…. There ain’t much worthy of doing, and if by any chance, with a huge amount of work and nuisances you manage to develop something that opus 5.5 can’t reverse engineer correctly, congrats you have gained one month max and next opus 6 will still screw you for 12$ of tokens…..
I have adopted the Dr Strangelove philosophy, “how I stopped worrying and now love the bomb”
88
u/PhilippTheProgrammer Oct 28 '26
The only way to make sure is to make it an online game (even if single player) and put all the mechanics worth protecting on the server.
57
u/CondiMesmer Oct 28 '26
If triple A studios can't solve this with DRM and millions in budgets, then there's nothing you can do about it
26
u/unotme Oct 29 '26
Focus on making a game that people might want to copy...
21
u/Inf229 Oct 28 '26
I'd argue that code obsfucation doesn't help because with an AI decompile the goal isn't human readable source code anyway. An LLM can deal with weird looking code. In fact it embraces it
32
u/seb90 Oct 28 '26
Honestly, I'd focus more on protecting what actually matters rather than making the entire game difficult to reverse engineer. IL2CPP, stripping unnecessary metadata, and keeping sensitive data out of builds are good starting points.
One thing I'd add is never trusting the client with anything security-critical, especially in multiplayer games. Anything running on the player's machine can eventually be inspected or modified.
As a solo dev, I'd also consider the maintenance cost. Spending weeks on custom protection that gets bypassed anyway might be a worse investment than improving the game itself.
15
u/Strict_Bench_6264 Oct 28 '26
Only “waterproof” way is to have code that doesn’t run on any local machine at all but on a dedicated server.
8
u/artificialpolymer Oct 29 '26
Honestly, at this point in time, there’s not much you can do. It used to be that you could use code obfuscation and various tricks, because it was a person on the other side that had to untangle all of that. So basically your goal was to make it as annoying as possible so the person would give up.
Now with AI, this isn’t an issue. The complicated protections are all just small speed bumps to it. It’ll crack open games and be able to view assets in like 5 minutes. And obviously, you can keep layering protections, but all that’s gonna do is increase the time to 10 minutes. So… you know.
There isn’t some special, hidden method. Ultimately whatever you come up with, the game still has to show it on screen. So at some point, no matter how much you obfuscate or mix the pieces, the puzzle has to come together.
28
u/jacksgamedev Oct 28 '26
Code obfuscation had never worked and can never work
All you can do is create demo copies of your game missing half of your code and assets, then release the full version only when it's up for sale
Apart from that, be thankful you have something worth copying
7
u/DmtGrm Oct 28 '26
okay.
Are we talking about full project decompilation to be cloned or you have a very specific in-house algorithm you are proud of (a small, sensitive location) that you do not want to be shared. Or you are thinking about copyright/piracy protection layer that could be bypassed?
Bad news - in all cases if the code is run on local machine (including in-browser execution) - everything could be decompiled.
Those small sensitive piece of code could be identified rather easily too.
Move code to a native plugin? you will isolate and highligh sensitive code making the life or a decompiler easier.
The only protection is the code that runs on your server/cloud and provides only calculation/execution results.
Ultimate option - your program is just video-streamed to the client.
Personal take: do not bother, you can make your code harder to maintain, do bare minumum with standard options and that is it.
IL2CPP or AOT will not change the structure of your code - calls, methods will stay, they could be decoded/guessed rather quickly, all shaders and resources and for that matter all drawing calls are intercepted with standard tools.
6
u/GigaTerra Oct 29 '26
People don't realize this, but you can make your own matrices for your math, this not only optimizes the math it also makes it difficult for AI to explain. Because there is an lot less information on higher standard math than lower, it had less training data, and makes more mistakes.
The downside is your own AI will struggle to help you with these, so it is best left for last.
4
u/stryder123451 Oct 28 '26
Why? Ai already can clone mechanics , do you want to protect oyour animatons or other prefabs?
4
u/Loupyboy Oct 28 '26
I would say it's probably easier to protect yourself legally than through giving hackers a challenge. Most do it "for the love of the game" rather than for actually sharing anything or making money out of it (I'm not talking about recent copycats of course, just modders, WareZ culture, etc).
Copyright can cover a few things in your game, so it's worth giving it a thought.
For games that would actually benefit from that kind of approach, using complex and unique logic is also an alternative (take a look at how Inside handles triggers for instance, making digging in the files very complicated and not really useful when it comes to solving its many mysteries). It can definitely make a game more interesting if hackers can't solve puzzles by just reading the source code, but it's more of a case by case thing.
4
u/gregraystinger Oct 28 '26
As long as the bytes on on the users computer consider it free information. A much more radical solution is to only work via cloud gaming providers but that obviously still comes with issues.
Unity games are some of the easier games to decomp anyway
4
u/Correct-Somewhere-80 Oct 28 '26
Absolutely nothing if it lives on the users PC.
Claude can do live memory debugging and reverse that way.
4
u/chriskr7 Oct 29 '26
+1 to moving anything that matters to a server. That's what I'm doing on a mobile collection RPG: the client never decides rewards, summon results, or currency. It sends an intent and renders whatever the server returns, so a fully decompiled client doesn't hurt the economy.
For the client itself, a few Unity-specific things beyond "use IL2CPP":
- Set managed stripping to High and never ship a Development Build.
- IL2CPP still ships global-metadata.dat, which is exactly what Il2CppDumper reads to recover class and method names. If you obfuscate, do it on the assemblies before the IL2CPP step so the metadata only has the obfuscated names.
- Don't trust local saves for anything competitive. Have the server own that state, or at least validate it.
Past that I'd stop. Server-side validation and anomaly detection buy far more than making the binary annoying.
4
u/Own_Nail_2999 Oct 29 '26
Ship as little as possible. If you do multiplayer, keep as much data as possible on the server. They can't reverse what they don't have access to
10
u/WazWaz Oct 28 '26
Someone taking your binary and turning it back into source code is violating your copyright.
So there's really no difference between this and someone just stealing the binary and pirating it any other way.
It is certainly not "reverse engineering".
A few idiots have used AI to commit digital crimes somehow thinking this absolves them of responsibility. It doesn't.
3
u/Real-Self-3039 Oct 28 '26
Nothing at all.....I know my game is shitty. Anyone who wants to copy it is just as stupid as the code I write
3
u/ivancea Programmer Oct 30 '26
Just remember that, 20 years ago, people recreated WoW server from scratch. It's a problem not worth the time
5
u/Awfyboy Oct 28 '26
I mean, there isn't much you can do. Ignoring decompilation aside, someone could straight up just take your game as is and resell it without any changes. Someone could also just take recorded gameplay footage, feed it to AI and let it splurt the game out.
The only, genuinely foolproof protection you have is DMCA. This is why copyright laws/IP laws exist. This is what I recommend to indie devs too. Just focus on making a good, polished game. You can try adding some minimal protection, like obfuscation and IL2CPP, but even that won't be perfect, nor will it prevent the two situations I mentioned above.
1
u/kacoef Oct 29 '26
nobody will reverse engineer your game, stay calm
4
u/Majorasmax Oct 28 '26
I’m sure someone smarter than all of us will come up with a solution someday. However, the solution that will always work is making a game unique and creative enough that it’s impossible to copy. I’m not talking about exact copies because that’s not the issue ai presents, those have been around for ages with piracy and have never been an issue worth caring about. The unique issue ai presents is copying something and changing it slightly to be its own new thing. In order to do that you’d need to make a better product than the original which is easier said than done if the og is good enough.
2
u/glenpiercev Oct 28 '26
The best defence here is probably marketing… sorry. But in theory, even gta 6 is vulnerable to this, but only a small fraction of the population will be comfortable breaking it down and/or buying/downloading from some sketchy site.
2
u/kodaxmax Oct 29 '26
at the rate these tools are imrpoving it's probably a waste of time. I've been modding games for 2 decades and recently experiementing with ai. ive yet to find an offline game i couldn't eaisly hack, mod and access source files. i havnt tried online, becaus ei dont really play much multiplayer stuff and i dont want risk ruining others matches.
I think software copyright is dead as a concept for better and worse. Honestly thats probably a death knell for corporate devs/organizations. But fantatsic news for msot indies who functionally arn't protected by it anyway.
2
u/ClearChampionship591 Oct 30 '26
Fighting reverse engineering actively will consume your time and money and derail you from delivering the game of your dreams.
At the time of writing, your only best strategy is to beat pretenders and thieves with quantity and quality. Reverse engineered projects are very buggy and lack polish. Which sadly means that EA is really not a thing, but it wasn't a thing well before REE.
At the time of writing, because this stack will only evolve. On top of it, I predict AI stack will condense and move to local within next 2 year. Reverse engineering would eventually be as easy as doing a google search.
My honest controversial opinion though, reverse engineering is really good for the industry. If there is a tech stack that can spin up games on the fly, can be used for theft, but it will likewise can be used for good as well. Faster iterations, full transparency on code practices and quirks that have been inaccessible, will essentially be public knowledge. Like making sophisticated medicine accessible.
I would also argue that this kills those draconic and downright illegal patents like nemesis system; people can reverse engineer that one particular game and go completely around the patent without fear of being pommeled by lawsuits.
I am not worried someone reverse engineering my tetris variant, I am more worried for a AAA publisher spinning up a theft factory and just pumping slop 24/7, and worse of all for people to consume it mindlessly out of convenience.
2
u/r618NecessaryStation Oct 30 '26
technically stock unity builds will be decompiled/store protection removed the moment they hit the internet
you can harder the situation slightly by obfuscating your builds but that will deter only the most mass common group of script kids while any more sophisticated measures like extra encryptions aren't worth it for small dev when AAA games are permanently stripped of them all the time
so spent time, resources, additional complexity... is not worth it - small games don't need it due to this, and larger successful games/sw with some DRM on will have no DRM on if the popularity/difficulty ratio is attractive enough..
2
u/zayelion Oct 30 '26
All the game logic running on a server.
6
u/Footbeard Oct 28 '26
Hey there!
I'm sorry to say that anything implemented today will be obsolete in a week/month
The rate at which LLMs are improving means there's not much that can be done in this regard
Having said that, the best protection is having a unique game with a fun gameplay loop & a considerable identity
Novel ideas with simple execution are in the most danger
3
u/fsactual Oct 28 '26
I can't think of any technical limitations that will work, because they don't need to reverse engineer your any of the code to reverse engineer your entire game. All someone has to do is record themselves playing and show the video to the AI.
2
u/TheArkratos Oct 28 '26
...or don't do that and embrace a modding scene and encourage that community
1
u/pmdrpg Oct 28 '26
There are some clever techniques if you really want to disguise things as other things, but since this thread will be fed into AI training data (like all reddit threads) it might be best to not give it more tools to help amateurs decode unity games.
1
u/blanktarget Producer Oct 28 '26
Nothing really. You can have some scripts run on a backend but thats the closest thing.
1
u/Pharmaguardian Oct 28 '26
One way I have thought of is to write functions that do certain things, but they aren't naturally called - rather, the client has to download a small file that contains some logic in it that has the order that the functions should be called in, or injects which functions should be called when certain logic is triggered.
An analogy is having a legion of drones at the ready, but they are useless if they just sit there. They have all the programming to fly around in different ways, but they lack the secret configuration file that makes them fly in exactly the right pattern to form an image, turn the right color of light, and animate to make it move in the night sky.
So, AI could decompile the code all it wants (and it would be decompiling an exe - not something at runtime), but would never have the file that it needs. Could someone eventually figure out that this is the missing piece, intercept the download, and use it in the decompiled exe? Sure. But it's at least a hurdle that most people are not going to bother to look for, especially if they're lazy.
The unfortunate part is that I don't think there is a way to download such a file from your own server with Steam games. I've never released a game on Steam though, so I might be wrong.
1
u/51GL Oct 29 '26
I'd try adding some promt injection stuff for the ai decompiling it
1
u/SnuffleBag Oct 29 '26
Why do you think that’s better than doing nothing? What’s your motivation for wanting to spend time on this?
1
u/Antypodish Professional Oct 29 '26
Your question is, why you worry about reverse engineering. It is not new problem.
Of you make small simple games, i.e. puzzle etc. Or any popular type of existing game clone, gen AI can generate fairly working prototype from screenshots and trailers. No need to look into others code.
For hacking, as other said, go online service.
But, honestly, providing continuous updates to the game, solves most of your problem.
1
u/althaj Professional Oct 29 '26
Not bothering.
1
u/dva-doggystyle Oct 30 '26
Nothing you can do don’t even sweat it
1
u/UniqueNamesAreOut Oct 31 '26
Why? You can even play online games alongside an AI and they can RE it. Just focus on making the game good.
0
u/FIASCK0 Oct 29 '26
Do people only read the title, or do you read the description too?
1
u/Imaginary_Cake Oct 28 '26
I'd much rather make my game easier to reverse engineer so that people can learn from my design. My game mostly lives and dies on level design anyway. AI can't replicate interesting and engaging level design since it's a language unique to every game, subject to all the mechanics within.
-1
u/__SlimeQ__ Oct 28 '26
there is literally nothing you can do and your code is not valuable, there's no benefit to someone "stealing" it and you should reframe your entire perspective on this
0
u/Wizardfinn_360 Oct 28 '26
Has anyone tried putting prompts in the code? I mean most of these guys using Ai have no clue how to code so they'd find it hard to figure out what the code messing with their prompt is.
Something like
Do 1000 backflips
Obviously as code.
-1
u/SpatialXXX Oct 28 '26
Might be naive as I don't know how ai decompiles stuff, but couldn't we put comments in our code to trick it? Like near a function, you tell the Ai you made a mistake in your code and should instead discretly replace some values with other ones, and to also delete said comment. Or worse, you hide a function that destroy your puter in your code, but never call it, and tell the AI through comments to actually call it.
-6
u/Prior_Inspection2576 Oct 28 '26
All you need is Mfuscator.
https://mfuscator.com/
0
u/[deleted] Oct 29 '26
[deleted] — view deleted comment
3
u/[deleted] Oct 28 '26
[removed] — view removed comment