Do unity offuscate the code?

Hi guys,can you help me?
Do unity 3D offuscate the code when compiling game??
if another person decompiling my apk,can his copy the code?
Thanks

They don’t obfuscate it, but the ahead of time compilation on some platforms is at least not as easily disassembled.

No it does not obfuscate the code, and in fact is quite easy to check it out. Watch how easy, no need even a brain to do it (next steps applies only to Unity APKs, for normal none-unity APKs there is different but also easy path):

  1. Rename the the apk file extension from .apk to .zip
  2. Open the zip file and browse to .\assets\bin\Data\Managed\
  3. There are several dll’s, extract somewhere the file Assembly-CSharp.dll
  4. Download any .Net decompiler and open this dll with it. A good one is the free “JetBrains dotPeek”

And that is all you need, now you can check the code of the app, but I wouldn’t say it’s useful to copy it, though people might pray to check out how you coded certain things.
So my recommendation if you are concerned about how easy is to perform such operation is that you google a bit for unity .net obfuscators and buy whatever you think is best for you.

PS: Maybe I shouldn’t have written this post at all, as it teaches how to decompile a unity apk. If anyone thinks is not constructive I will delete it.

Decompilers have really come a long way. My IDE can display code from a .NET DLL that looks just like human-written code to me. Especially in .NET languages, the idea of obfuscating code is not even really considered in favor of maintainability and a better compiler. Going backwards from CIL to C# is almost trivial.

You should consider that whatever you have coded can be coded by other people as well. Most things people want to obfuscate is something that many other coders could already do if they put in the time. There isn’t much secret sauce in what we do.

@perracolabs , I think it’s important programmers understand how easy decompiling .NET is. Also understanding DLLs and how they relate to code can only be a good thing to programmers!

If you want some parts of your code to be shielded - or at least harder to reach - you can always build native/C++ .DLL and use those in your project. (It requires Unity Pro)