Try โ€‚โ€‰HackMD

Stripped Unity games and how to unstrip them

Some game developers tend to enable assembly stripping when releasing this game. It's an option that barely saves any space and is generally a nuisance for game modders yet for some reason still available for PC.

In most cases the issue can be fixed by restoring the stripped assemblies.

NOTE

This is not a definitive guide. You may need to adjust it to your own needs. Don't hesitate to experiment and ask for help when stuck.

Symptoms

Before you start the painful work, check that at least one of these applies to your game. It's fine if you don't, but checking first will save you about 0.5-2 hours of your life.

  1. Unusual MissingMethodExceptions or TypeLoadExceptions when using BepInEx.

    If you install clean BepInEx and run it, you may stumble upon MissingMethodExceptions.
    Such examples are

    • System.MissingMethodException: void System.Reflection.Module.GetPEKind(System.Reflection.PortableExecutableKinds&,System.Reflection.ImageFileMachine&)
    • No error logs are created
  2. Core DLLs are small

    Go to <Game Name>_Data/Managed folder and check filesizes of some core libraries.
    Their sizes should be within the following ranges:

    • mscorlib.dll: over 3.5 MB
    • System.dll: over 2.5 MB
    • System.Core.dll: about 1 MB

    If these files are a lot smaller than these reference sizes, your game might have stripped DLLs.

How to unstrip my game?

Obtain original core DLLs

  1. Check your game's Unity version. You can do it one of the following ways:

    • Open Properties of the game's executable and check its file version:

      Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More โ†’

      First three numbers (X.Y.Z) are the Unity version

    • Open <Game Name>_Data/globalmanagers in a text editor (e.g. Notepad). At the very beginning, find a string that looks like a version number:

      Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More โ†’

  2. In your browser, go to https://unity.bepinex.dev/corlibs/<unity version>.zip where <unity version> is the Unity version of the game, e.g. 2019.4.24.

  3. Extract the assemblies into a temporary folder

  4. In your browser, go to https://unity.bepinex.dev/libraries/<unity version>.zip where <unity version> is the Unity version of the game, e.g. 2019.4.24. Download the ZIP and extract it into the same temporary folder.

Move unstripped assemblies to the game (THE DIRTY BUT BASIC WAY)

Take all assemblies you have copied into the temporary folder and move them into <Game Name>_Data/Managed. Overwrite when asked.

Move unstripped assemblies to the game (THE CLEAN BUT MORE INVOLVED WAY)

  1. Create folder named unstripped_corlib in your game folder (the folder where the game EXE resides)

  2. Move the assemblies you copied into unstripped_corlib

  3. Open doorstop_config.ini in a text editor of your choise (e.g. Notepad)

  4. Find option named dllSearchPathOverride and set it to the following:

    โ€‹โ€‹โ€‹โ€‹dllSearchPathOverride=unstripped_corlib
    
  5. Run the game