Getting a script from .unity3d file

Hey guys! How can I get a JavaScript script from the webplayer? I know the exact name (MazeGeneration.js) and I have the unity3d file locally but I accidentally lost the script and I haven’t got it backed up :/. I really need your help guys.


First you will have extract the DLL with your code. I did it once playing the .unity3d file in the Webplayer and examining the browser’s memory with OllyDbg. This DLL contains the code from all your scripts (in Javascript) compiled in the same step (see Unity Docs).

With the DLL in hands, you can use a .NET disassembler, if you can understand CIL, or a decompiler like .NET Reflactor, that will generate code in a supported high level language (usually C#. UnityScript is very unlikely)

Beware that the code will lose all the comments and local variables names. Besides, coroutines will pollute a lot the code, so if you used them it may be hard to understand what’s happening.