2
\$\begingroup\$

I accidentally deleted my game. I had been working on it for about 2 months and I accidentally deleted it while cleaning up my files. I am so smh. I have a ton of builds of the game though and since the game and all its scripts were converted to a file. Would I be able to un-pack said build back into a Unity project? I am not that cut about the game because I didn't like it but I did spend a lot of time on it. Oh yeah and also it was a school assignment.

\$\endgroup\$

3 Answers 3

5
\$\begingroup\$

No, you cannot unpack a Unity build into the source files for the project.

You can decompile the managed assemblies to get equivalent C# code out of them, but it won't be exactly the code you wrote. It will likely be mangled and harder to read, lacking comments etc.

You can try to extract assets like textures too, but you won't get your original files back. In order to make them fast to load and efficient to display on graphics hardware, Unity converts files to GPU friendly formats and applies various compression strategies to them as part of the build process. This can be lossy — the texture you get at the end is not necessarily a pixel-for-pixel match with the input image.

If you have one specific script you don't remember how to write, or one specific image asset you can't re-make, then these strategies might be worthwhile to get a starting point you can then edit by hand back to what you want it to be.

But for most purposes, you'll be better off remaking the project from scratch, using what you learned the first time around to do it better this time.

One such lesson should be to use a version control system and keep a backup somewhere so you never land in this situation again.

\$\endgroup\$
5
  • \$\begingroup\$ How would I be able to decompile/extract "assemblies" to get said c# code out of them? I did some quick searching and turned up empty handed other then this forum.unity.com/threads/…. Also that's a shame that I cant re-convert it and also not a shame at the same time because its good that unity is compressing the daylights out of all files so my games are smaller in size. \$\endgroup\$
    – Object
    Commented May 8, 2021 at 12:33
  • 1
    \$\begingroup\$ Top search hits for "unity decompiler" turn up this tool, which promises to decompile a whole Unity project, though it doesn't appear to have been updated since version 5.6. You can also use generic C# decompilers on the .dll files in your builds. \$\endgroup\$
    – DMGregory
    Commented May 8, 2021 at 12:39
  • \$\begingroup\$ All of this decompiling stuff hurts my head. I cant afford to loose my sanity anytime soon. I'll just work on my new game that I'm developing for now and give it another crack in the future. Thanks for the help! I really appreciate it but I wont accept it as an answer yet until I actually get my scripts decompiled. \$\endgroup\$
    – Object
    Commented May 9, 2021 at 11:01
  • \$\begingroup\$ I accidentally deleted another game. Wow. \$\endgroup\$
    – Object
    Commented Jun 23, 2022 at 12:07
  • 2
    \$\begingroup\$ "One such lesson should be to use a version control system and keep a backup somewhere so you never land in this situation again" — this will keep happening until you learn this lesson. \$\endgroup\$
    – DMGregory
    Commented Jun 23, 2022 at 12:08
1
\$\begingroup\$

Yes, you can. Try programs like AssetRipper (which's a fork of uTinyRipper program).

How well these programs cope with unpacking depends on the unity version, the older it is, the better.

\$\endgroup\$
-1
\$\begingroup\$

Sorries You Cant Convert It Back

\$\endgroup\$
2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .