Brand New Unity Project: My Starter Kit

Testing is a core tenant I believe helps me produce high quality software. In order to have faith in a test suite that is assembled is to constantly verify every code change that is introduced to the system.

Github Actions (docs) is a wonderful workflow based system that can easily integrate with a Github project. Since Github is my version control repository of choice, it is natural for me to adopt it.

I lean heavily on Game.ci (docs), which is an open source project that uses containers and wizardry to produce Unity game builds.

Here is my default github actions definition for a unity project. There are assumptions that must be true

  • The unity project files are a subdirectory (aka subfolder) of a directory named unity. This directory will be the watch directory. This isolation allows this workflow to only build if unity project files are touched (aka dirty).
  • This example uses my latest unity project global-game-jam-2022. If you are using vim, you can change the project name with this snippet: %s/UNITY_PROJECT_DIRECTORY_NAME/ your desired name here (remove spaces) /g
  • Github Pages (docs) is enabled and is targeting a docs subdirectory in the root of the project folder. That is ultimately where some unity webGL build files will go.
  • This file needs to go in the .github/workflows directory. If you do not have it, run mkdir -p .github/workflows to create it.

This is the result of the file looks like this.

Successful build of this Github Actions workflow
Play mode tests
Edit mode tests

My Default WebGL Template

Unity allows creators to define custom webGL templates (docs). Here is what I like to use myself. Remember that the WebGLTemplates folder has to be inside a Unity project’s Assets folder.

Before
After

From here it is easy to imagine how to extend the webGL template files to accommodate whatever web browser features you may want to utilize.

Leave a comment

Your email address will not be published. Required fields are marked *