Skip to main content
Version: v4 (current)

Activation

The orb uses a Unity Editor instance to test and build your projects. Before each job, the orb activates Unity with your Unity account email, password and serial.

Unity separates its licenses between Personal and Professional. The former applies to the free and the latter to the Pro and Plus versions. Based on your use case proceed to the Personal or Professional license section.

Personal license​

Follow these steps if you are using Unity's free version.

Note: Do NOT follow the steps for the personal license if you have a professional license.

Personal licenses have no serial key. The orb extracts it from your Unity license file (.ulf).

Getting the license file​

  1. Install Unity Hub on your machine and log in with the Unity account you want to use in CI.

  2. Go to Unity Hub ⇢ Preferences ⇢ Licenses, click Add and select Get a free personal license. Even if a license is already listed, click Add to make sure the file gets created.

  3. Find the Unity_lic.ulf file:

    • Windows: C:\ProgramData\Unity\Unity_lic.ulf
    • Mac: /Library/Application Support/Unity/Unity_lic.ulf
    • Linux: ~/.local/share/unity3d/Unity/Unity_lic.ulf

    The license isn't tied to an operating system: you can get it on Windows or macOS and use it in Ubuntu jobs.

Encoding the license​

CircleCI environment variables work best on a single line, so encode the file to base64:

# Linux
base64 -w 0 Unity_lic.ulf
# macOS
base64 -i Unity_lic.ulf

Configuring your Context​

  1. Navigate to CircleCI ⇢ Organization Settings ⇢ Contexts ⇢ Create Context and choose a name for your context (e.g. unity). Alternatively, open an existing Context that you would like to use.
  2. Create the following environment variables:
    • UNITY_LICENSE - (Paste the encoded license from the previous step)
    • UNITY_EMAIL - (Add the email address that you use to log in to Unity)
    • UNITY_PASSWORD - (Add the password that you use to log in to Unity)

Professional license​

Follow these steps if you are using Unity's Pro or Plus version.

Note: Do NOT follow the steps for the professional license if you have a personal license.

  1. Get your Serial Key from the subscriptions page.
  2. Navigate to CircleCI ⇢ Organization Settings ⇢ Contexts ⇢ Create Context and choose a name for your context (e.g. unity). Alternatively, open an existing Context that you would like to use.
  3. Create the following environment variables:
    • UNITY_SERIAL - (Paste the serial acquired in step 1 here. It should look like this: XX-XXXX-XXXX-XXXX-XXXX-XXXX)
    • UNITY_EMAIL - (Add the email address that you use to log in to Unity)
    • UNITY_PASSWORD - (Add the password that you use to log in to Unity)

GameCI does not acquire nor store your Unity email, password, serial or license file. They are only used to activate Unity during your jobs.

Upgrading from version 1.x​

Version 2 activates Unity the same way as the GitHub Actions. Unity no longer supports manual activation with .alf files, so the old personal license flow stopped working.

  • Rename unity-username-var-name to unity-email-var-name. Its default is now UNITY_EMAIL.
  • The unity/create-activation-file job was removed. Get a license file as described in Personal license.
  • unity-license-var-name now defaults to UNITY_LICENSE. An existing UNITY_ENCODED_LICENSE variable still works if you pass unity-license-var-name: 'UNITY_ENCODED_LICENSE'. Email and password are now required for personal licenses too.
  • fetch-submodules now defaults to true, since 1.x always fetched submodules.
  • The unity/macos executor only accepts the m4pro.medium and m4pro.large resource classes, since CircleCI retired the M1 machines.
  • On macOS, the Editor is now installed with the Unity CLI instead of the Unity Hub (from orb 2.0.1). UNITY_HUB_PATH is no longer exported; custom steps that ran "$UNITY_HUB_PATH" -- --headless install-modules ... should run "$UNITY_CLI_PATH" install-modules -e <version> -m <module> instead. See Unity's migration guide.

Next steps​

Now you are prepared to start testing and building your Unity project. However, remember to reference your context in every job you run; otherwise, they will fail:

version: 2.1

orbs:
unity: game-ci/unity@2

workflows:
build-unity-project:
jobs:
- unity/test:
...
context: unity
- unity/build:
...
context: unity