Is there a way to put both 32-bit and 64-bit exe files in the same build?

You know in some games where they have two .exe files in the install folder, one for 32-bit and another for 64-bit? Any way I can do that also for my Unity game? I was thinking of doing that so I don’t have to put up two installers for download.

I’m wondering if there’s a way to do it as the exe file’s name has to match the data folder’s name, but to put both 32-bot and 64-bit exe files I’d obviously need to rename them.

Based on recent testing with Unity 5.2.2 and Windows standalone builds, what you want to do is almost possible. The good news is that the built data is all compatible (including asset bundles) as are the managed DLL’s compiled from your source code (or compiled externally, for example in Visual Studio).

However there are two problems:

  1. Unity will look for your data in the _Data folder, and renaming the executable changes where it looks for data.
  2. The Mono framework in _Data\Mono\mono.dll is either 32-bit or 64-bit, and so needs to be swapped to match the executable.

I was able to build our game twice, once for 32-bit and once for 64-bit, and if I copy the 64-bit executable and mono.dll into the 32-bit build then it runs fine. However I don’t know how to get both executables to co-exist simultaneously due to the two issues above.

You could create an installer (or use architecture-specific Steam depots) to address the issue at setup time. Also note that if you use native plugins it will require a bit of additional work to load the compatible version.

Note that the built data is compatible between built versions, but will not be identical. Which is a separate issue - if I make back to back builds with all the same data and the same settings I get very different built data, which is lousy for patch size.

I guess what you’ll do it build each version, then check that the data folders are identical. Assuming they are, when you create your installer, you’d have a post install step that looks at the OS that the user is running on, and rename the 32-bit or 64-bit exe to match the name of the data folder.