Primer
I found that some people on the Internet made very good Unity games. I wanted a copy of the source code to study, so I found the APK of some games. I decompiled the apk with dnSpy software and got the source code of the Unity game (including resources and code)
resource preparation
dnSpy
dnspy GItHub download address
Unity APK
Prepare an Apk you want to decompile
download dnSpy
Open the GitHub download address of dnSpy, as shown in the figure below
As shown in the figure below: This is the dnSpy folder after downloading
Decompile Unity Apk
1. Prepare a Unity Apk
As shown below:
2. Modify the file format
Change the suffix name of the Apk file from .apk to .rar or .zip format, as shown in the figure below:
3. Unzip the file
As shown in the figure below, this is the folder structure directory after decompression
4. Folder function analysis
assets | Resource files and code files in the Unity project |
lib | so files required by arm and x86 |
META-INF | information package |
res | Store resource images such as Icon, etc. |
AndroidMainifest.xml | manifest file |
classes.dex | Android Dalvik bytecode |
resources.arsc | Compiled binary resource file |
The editor of this article mainly focuses on the assets file directory, which contains the resources and codes I want
5. View the source code
Operate as shown in the figure below. If Assembly-CSharp.dll cannot be found after opening, it is possible that this Unity Apk is built in IL2CPP mode, not in Mono mode.
Operate as shown below
Decompile Apk renderings
Summarize
Unity games are too easy to be analyzed. If the project is very important, then code obfuscation, encryption and other work are still very important
Of course, in addition to textures, audio files, xml files, shaders, etc. can be viewed, but the model cannot be extracted visually (this requires disunity)