Unity Scripts Can be stolen?!

Hi all, A fried discovered that scripts in games made with Unity can be extracted from the games after being build (.exe).

Hes said he uses the files named:

Assembly-CSharp.dll
Assembly-UnityScript.dll

and he was right.

Is there any way to over come this problem and protect my game scripts from being stolen after building it?

sorry if my English is bad.

No you can’t do much about it. The problem exists with any kind of software. Since the processor have to execute the code it have to be available. Any kind of code can be decompiled to a certain level. Pure machine code can always be viewed in assembler.

However a feature of the scripting language used in Unity (CIL Common Intermediate Language) is, that CIL code can be almost fully decompiled in any .NET / Mono supported language if there’s a decompiler for that language. Most decompilers have problems with generator functions (coroutines in Unity) but they can always be viewed in IL. Just download ILSpy and try it yourself :wink: Take a look into the UnityEngine and UnityEditor dll, it can help to understand the GUI system for example.

There is the Unity3DObfuscator which can be used to make the code almost unreadable. It just replaces function and variable names with some random characters so it’s hard to determine what the code does, but it still can be figured out :wink:

This is a general problem with managed code. Java has the same problem. Minecraft for example was never ment to be altered by the community. Some people just decompiled the whole game to be able to integrate the mods. They ultimatively created a set of tools (the MCP) that can decompile and also deobfuscate the code.