-
Notifications
You must be signed in to change notification settings - Fork 332
Building DFU for distribution
Daggerfall Unity has some small details that need to be taken into account when making a build for distribution to users. While Unity itself has a simple "one click build" setup, lots of minor details handled by the Unity Cloud build over the years need to be replicated by hand when building locally on a normal machine.
The basic process for building DFU is as follows.
- Go into File -> Build Settings
- From Target Platform, select the platform you want to build (architecture can be selected later)
- After Unity has done the necessary platform configuration, go to Window -> Asset Management -> Addressables -> Groups
- From the Addressables Groups, run Build -> New Build -> Default Build Script
- Once building Addressables is done, go back to the Build Settings window, select your Architecture, and then Build
These 5 steps need to be repeated for each platform, in this order.
The output destination changes depending on the platform. Unity handles all three platforms differently for some reason.
- Windows: An output folder needs to be specified. Usually something like Build/Win32 or Build/Win64
- Linux: An output executable name needs to be specified, and the other files will be in the containing folder. Usually Build/Linux/DaggerfallUnity.x86_64
- OSX: An output folder needs to be specified, and its name has to be DaggerfallUnity.app. Usually Build/DaggerfallUnity.app
Some steps need to be taken to ensure users get files in a format consistent with previous versions. The following scripts have been created to automate some of the modifications needed for each platform. These are assumed to run on Windows, though one of the two runs in Windows Subsystem for Linux (WSL).
zip_win_builds.bat
@echo off
rename ".\Build\Win32\Daggerfall Unity_Data" "DaggerfallUnity_Data"
rename ".\Build\Win32\Daggerfall Unity.exe" "DaggerfallUnity.exe"
del ".\Build\dfu_windows_32bit-%1.zip"
7z a -tzip ".\Build\dfu_windows_32bit-%1.zip" ".\Build\Win32\*"
rename ".\Build\Win32\DaggerfallUnity_Data" "Daggerfall Unity_Data"
rename ".\Build\Win32\DaggerfallUnity.exe" "Daggerfall Unity.exe"
rename ".\Build\Win64\Daggerfall Unity_Data" "DaggerfallUnity_Data"
rename ".\Build\Win64\Daggerfall Unity.exe" "DaggerfallUnity.exe"
del ".\Build\dfu_windows_64bit-%1.zip"
7z a -tzip ".\Build\dfu_windows_64bit-%1.zip" ".\Build\Win64\*"
rename ".\Build\Win64\DaggerfallUnity_Data" "Daggerfall Unity_Data"
rename ".\Build\Win64\DaggerfallUnity.exe" "Daggerfall Unity.exe"
Open any Windows console in the base DFU folder, and run as .\zip_win_builds.bat v1.1
. The script expects Win32 and Win64 builds under Build/Win32 and Build/Win64, and will produce dfu_win_32bit-v1.1.zip and dfu_win_64bit-v1.1.zip under Build.
This requires 7z.exe being installed and set up under the Path environment variable.
Despite Unity producing a build with the executable Daggerfall Unity.exe
, this script ensures that the file in the zip is DaggerfallUnity.exe
, for consistency with previous installs (same with the "Daggerfall Unity_Data" folder). This is not an issue on OSX and Linux.
zip_unix_builds.sh
#!/usr/bin/bash
rm -r /tmp/dfu
mkdir /tmp/dfu
cp -r Build/Linux/* /tmp/dfu
pushd /tmp/dfu
zip -r dfu_linux_64bit-$1.zip *
popd
cp /tmp/dfu/dfu_linux_64bit-$1.zip Build
rm -r /tmp/dfu
mkdir /tmp/dfu
cp -r Build/DaggerfallUnity.app /tmp/dfu
pushd /tmp/dfu
zip -r dfu_mac_universal-$1.zip *
popd
cp /tmp/dfu/dfu_mac_universal-$1.zip Build
Open any WSL console in the base DFU folder, and run as ./zip_unix_builds.bat v1.1
. The script expects OSX and Linux builds under Build/DaggerfallUnity.app and Build/Linux, and will produce dfu_mac_universal-v1.1.zip and dfu_linux_64bit-v1.1.zip under Build.
This requires zip
being installed in your WSL setup.
The zipping is done in a Linux space in order to preserve file permissions, such as executable rights on DaggerfallUnity.x86_64. An archive format like 7z would not preserve those file permissions, and zipping in a Windows environment would ignore all the Unix file permissions too.