Fixing a Unity Build that Won’t Run due to a Broken

Here’s an odd little tidbit I ran into while trying to run a Unity build I got from a student.

When I tried to run a Windows build of their Unity project, the game would almost immediately end. I would see the executable show up briefly in the Task Manager but it would quickly disappear and the game wouldn’t run. Naturally, I could have asked the student to produce a new build, but it was late and I was curious as to what was different from this build versus all the others that I had run successfully.

I ran a diff across the broken Unity build’s files and the files in a working Unity build. While sorting through the results and ignoring files that should obviously be different (like assets), I stumbled upon something odd in the file located in the builds’ Data folders. While the working build’s had a company and app name, the broken build had a series of zeroes.

Two images of from a working Unity build and a broken Unity build. The former has text listing the company name and app info. The latter is a series of binary zeroes.

The contents of two files. A working one on top and a broken one on the bottom.

As a test, I overwrote the broken build’s with the working build’s and, sure enough, the broken build now ran! Using another copy of the broken build, I opened it’s in a text editor and entered a company name and app name by-hand and saved it. This also fixed the broken build.

I haven’t nailed down exactly how that one build’s, but I hope to find out soon. In the meantime, if you run into a Unity build that mysteriously quits, take a peak at the file. The problem may be easier to fix than you think.

Posted in Tech, Unity.