Unity Decompiling Guide
Decompiling is the process of converting machine code into a high-level format. This allows to inspect and partially retrieve code from a compiled program. There are many reasons you might want to decompile a product:
- Find flaws in the product
- Recover the source code
- Learn from others' code
- Extract assets
- Modify the product
This guide focuses on Unity games. It will not work for Unreal Engine or other game engines.
Step 1: Obtain the Game
You need access to the game's executable files. Avoid pirating the game — it's both unethical and illegal. Always own the game you're working with.
Step 2: Extract the Unity Project
- Download the correct Unity Editor
Use a tool like BepInEx to detect the Unity version. Match the Unity Editor version accordingly. Mismatched versions may cause bugs.
- Download AssetRipper
Get it from AssetRipper GitHub. - Open AssetRipper.
- Go to File > Open File and select the game executable.
- Click Export > Export All Files.
- Choose a destination folder.
- Click Export Unity Project.
- Open the
ExportedProjectfolder in Unity.
Note: The initial export may take time. Future loads should be faster.
Step 3: Fix Common Errors
If Unity prompts to open in Safe Mode, there are likely issues to fix.
Broken DLLs
Error message: "Unloading broken assembly 'AnyDLLFile'"
- Go to the
Pluginsfolder. - Select the broken DLL.
- In the Inspector, set the OS to Windows.
- Click Apply.
Black Scene
If the Scene window is blank, check the OS settings for these DLLs:
Unity.RenderPipelines.Universal.Runtime.dllUnity.RenderPipelines.Core.Runtime.dll
Broken or Invisible Text
- Locate the shader used in the font material.
- Replace it with a clean version. If using
TextMeshPro/Mobile/Distance Field, you can use this shader. - Create a file named
TMPro_Properties.cgincin theShaderfolder. You can get the file from this source or a blank Unity project.