Skip to content

Unity

Your Unity License is required to do some Git CI. To find your license, search your disc for a file called Unity_lic.ulf. If you can’t find one, look for any .ulf files that might be it. Usually, license files are found in C:\ProgramData\Unity. If there is one, great! If not,

  1. Open Unity Hub

  2. Click ‘Licenses’ on the list of tabs on the left

  3. Click ’+ Add License’

  4. Click ‘Get a free personal license’, even if you already have one. If you already have one, it won’t override your old one.

  5. Search for Unity_lic.ulf again

If you’re on a computer with multiple users, you should delete your license file.

If you need the license for a secret for a GitHub Action, copy the entire contents of the file into the secret.

GitHub has support for a continuous development/continuous deployment workflow. Unity has support for building and running unit tests.

  1. Create .yml GitHub Action scripts in

    • DirectoryProject root
      • .gitignore
      • Directory.github This folder may be hidden
        • Directoryworkflows
          • github-action.yml
      • DirectoryAssets/
      • DirectoryLibrary/
  2. Follow the steps above to find your Unity License

  3. Navigate to your GitHub repository’s action secrets found in Settings -> Secrets and Variables -> Actions

  4. Add a new action secret by clicking ‘New Repository Secret’. For these actions to work, you need three, named the following: UNITY_EMAIL, UNITY_PASSWORD, and UNITY_LICENSE. The value of the first (what you put in the value field) is the email account associated with your Unity account. The second is the password to your Unity account, and the third is the entire contents of the license file (.ulf or .alf, depending if you have Personal or Pro).

Documentation for GitHub actions can be found here.

The following actions will trigger whenever you make a pull request to main (or commit to a branch that’s making a pull request to main). Replace UNITY_VERSION_HERE with your project’s Unity version and TARGET_PLATFORM_HERE with the associated tag for your build type. Find the list of build types in Unity’s Documentation. Find more information about Game CI (the source of the Docker images that these tests use to run Unity) here, and learn more about Docker here!

unity-build.yml
name: Unity Build
on:
pull_request:
branches: [ main ]
jobs:
build:
name: Build for Windows
runs-on: ubuntu-latest
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@v1.3.1
with:
android: true
dotnet: false
haskell: true
large-packages: true
- name: Checkout
uses: actions/checkout@v4
- name: Cache Library
uses: actions/cache@v4
with:
path: |
Library
obj
key: UnityBuildCache-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: |
UnityBuildCache-
- name: Build Project
uses: game-ci/unity-builder@v4
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
with:
unityVersion: UNITY_VERSION_HERE
targetPlatform: TARGET_PLATFORM_HERE # (StandaloneWindows64 for a Windows Build)
- name: Upload Build
uses: actions/upload-artifact@v4
with:
name: Build
path: build