Code obfuscation

I’m almost ready to release my new game for iOS and Android. I want to protect some parts of the code, so it’s harder to decompile. But before buy some obfuscator from asset store, I would like to know how code is seen when someone decompiles it.

I see that people uses il2spy to see the code inside dlls. But, for an Android apk, where can I find these dll files? I used apktool to extract files, but I cannot find them.

So, questions are:

  • Do I need an obfuscator because it’s relatively easy to decompile and see code?
  • If answer to previous question is “yes”: how can I see it?

You can extract .apk files like archive files and see the content, just go to assets/bin/ and here you go, there are the binaries and DLLs, use IL2Spy to see the code.

  • Yes, you need obfuscator, because it is really easy to decompile code.
  • Just open the DLL binary using IL2Spy.

Hope this helps.
Thanks.

1 Like

Since APK’s are just JAR files, and JAR files are just ZIP files with an extra manifest file included, you can open APK’s in WinZip, winrar, or whatever your favorite archive application is. Windows even has built in ZIP support, but you might have to rename the file extension to .zip first.

1 Like

Thanks for your answer. I used ilspy to see my code in assets/bin/Data/Managed/Assembly-CSharp.dll. I can see it exactly as I wrote it! :hushed: I think Unity should obfuscate the code…

Do yo know a good obfuscator?

1 Like

I don’t have any experience with Obfuscation because I don’t use it.

As the other articles states, it seems the IL2CPP is secure if you are compiling to Android, Give it a try and check if it can be decompiled or not.

But the right answer is you can’t protect your project from pirates and hackers, these such tasks just take a bit more time from them.

Anyway, you can search for Unity obfuscation in asset store or Google to find good resources.

2 Likes

Obligatory (if they want it bad enough they will get it) post. Your best bet is a paid asset.

1 Like

iOS and Android both support IL2CPP builds, just use it.

IL gets converted to C++ which is then compiled to object code. The object code is not intentionally obfuscated, but is practically obfuscated.

1 Like

I’m receiving an error when compiling for Android using IL2CPP… don’t know why :frowning:

What is the error message?

This one:

Fatal error in Unity CIL Linker
System.NullReferenceException: Object reference not set to an instance of an object
  at UnityLinker.AddUnresolvedStubsStep.GetTypeModule (Mono.Cecil.TypeReference type, Mono.Cecil.AssemblyDefinition[] assemblies) [0x00001] in <81b71c29c35449f8a666455c78a2dcfb>:0
  at UnityLinker.AddUnresolvedStubsStep.GetTypeModule (Mono.Cecil.TypeReference type) [0x00001] in <81b71c29c35449f8a666455c78a2dcfb>:0
  at UnityLinker.AddUnresolvedStubsStep.Process () [0x000b5] in <81b71c29c35449f8a666455c78a2dcfb>:0
  at Mono.Linker.Steps.BaseStep.Process (Mono.Linker.LinkContext context) [0x00018] in <09bca01fd71241c7a07af8c71eb6ae1a>:0
  at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00020] in <09bca01fd71241c7a07af8c71eb6ae1a>:0
  at UnityLinker.UnityDriver.Run () [0x00086] in <81b71c29c35449f8a666455c78a2dcfb>:0
  at UnityLinker.UnityDriver.RunDriverWithoutErrorHandling () [0x00001] in <81b71c29c35449f8a666455c78a2dcfb>:0
  at UnityLinker.UnityDriver.RunDriver () [0x00002] in <81b71c29c35449f8a666455c78a2dcfb>:0

It is a bit strange for me.

Try some googling, you might find useful resources.

Excuse me, i can’t help you in this case, but i saw a similar problem that was related to Stripping, and they solved it by adding some link.xml file.

Hope this helps.
Thanks.

1 Like

Should I open a new thread or can I revive this one ?
Is there a good option for obfuscation ? I tried obfuscator but it breaks a lot of things by default

I think using IL2CPP will be enough. C++ code is not as easy to decompile as Mono.

1 Like

Good Idea I should try to see what it does on my projects