If you are a Unity developer and you don't have access to Unity Cloud Build or a dedicated computer, you might find the build process of Unity a bit tedious. You have to stop working for several minutes, especially when building for WebGL.
Well, no more! With this script you can start the build process and, while waiting, continuing to do all sort of works on your Unity project and not waste time.
- Copy
ParallelBuild.ps1
andbuildsettings.json
wherever you want, even though I suggest placing them at the root of your project. This way, you can omit theprojectPath
and build from the terminal of your preferred code editor while working on the project. - Copy
WebGLBuilder.cs
in a folder calledEditor
inside of youAssets
folder, for instance:Assets/Editor/WebGLBuilder.cs
. What is important is that the file has a parent folder calledEditor
inside ofAssets
. - Tweak the
buildsettings.json
file according to your needs:projectPath
: the path of you project (default to the directory theParallelBuild.ps1
file is placed in).buildPath
: the path relative to the root of the project where the build will be placed.parallel
: whether the build should be parallel or a standard one (but why would you?)publishToItch
: whether to publish the game on Itch when the build is finished successfully.itchUser
: the Itch user you want to publish toitchGame
: the name of the Itch game you want to publish to
- Make sure you can execute the
ParallelBuild.ps1
file, if you don't you can allow its execution with:
Unblock-File -Path \ParallelBuild.ps1
- Simply type
./ParallelBuild.ps1
This script simply makes a copy of the project and then runs the build on the copy, allowing you to continue working on the original one. At the end, the copied project is deleted. Be careful, when this script is working you can find the copied project listed in the Unity Hub, so don't mistake it for the original project.
This script is quite simple and for the moment has some limitations, which I may address in the future, such as:
- Works only for WebGL builds
- Works only on Windows
- Show the copied project in the Unity Hub while the script is working
- It is cumbersome to install and update