Skip to content

Add support for v3 docker images and upgrade Unity to 2022.3.4f1

Gabriel Le Breton requested to merge add-support-for-v3-images into main

What this fixes

  • Using v3 docker images with previous implementation leads to the following error messages:
[Licensing::Client] Error: Code 500 while processing request (status: Unable to update licenses. Errors: Machine bindings don't match,Token not found in cache)
[Licensing::Client] Error: Code 500 while updating license in client (status: Unable to update licenses. Errors: Machine bindings don't match,Token not found in cache)

Changes in this merge request

I'll need to come back here and clean things up a bit, but this should work better with recent images.

  • I updated project to 2022.3.4f1
  • I updated .gitlab-ci.yml adding removing get_activation_file which is not supported anymore
  • I updated the scripts in ./ci folder to use scripts that are closer to what's inside game-ci/unity-builder/tree/v4.1.3/dist/platforms
  • I added return_license.sh
  • The before_script actually clones unity-builder and the main reason for this is to get hands on its blank project to perform licenses verification and license return

How to use this

The environment variables changed a bit and that is to match what we're using in unity-builder v4.1.3.

  • UNITY_EMAIL instead of UNITY_USERNAME
  • UNITY_PASSWORD that didn't change, make sure you don't use special characters like ', !, ~ or spaces like
  • UNITY_SERIAL yes, you need to work with serials now

When working with env variables with gitlab and using different branches, you might want to uncheck Protect variable flag so your secrets are available to all branches.

How to retrieve your unity license file.

Instructions extracted from GameCI most recent Activation documentation for Personal Licenses.

  1. Install Unity Hub on your local machine.

  2. Log into Unity Hub with the Unity account that you are using for CI. Make sure you log into the correct account or you may not activate the correct license.

  3. When prompted, activate your personal license. If you are not prompted, go to Unity Hub > Preferences > Licenses > Add and choose Get a free personal license. You do not need to install an editor on your local machine.

  4. Depending on the host you are using, find the .ulf file which is your Unity license in the following paths:

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

    If you have issues locating the file, ensure you've logged into Unity Hub AND activated your license. Otherwise the file will not be present. Keep in mind these folders might be hidden by default, you may need to reveal hidden files to see them.

    Note: The host platform you use to activate the license does not matter. You only need to get the ulf from the platform that is most convenient to you. For example, using Windows to activate your license and building on Ubuntu on Github is perfectly fine.

How to extract your unity serial from your unity license file.

Now that you have your hands on your Unity_lic.ulf file, you can actually extract a serial from it by decoding the base64 value inside DeveloperData key. You can also do this using shall command fu

cat Unity_lic.ulf | grep DeveloperData | sed -E 's/.*Value="([^"]+)".*/\1/' | base64 --decode

Explanation of above command

  • cat Unity_lic.ulf: This command reads the content of the specified file.
  • grep DeveloperData: This filters the output to only include lines that contain "DeveloperData".
  • sed -E 's/.*Value="([^"]+)".*/\1/': This part uses sed, a stream editor, to extract the base64 value. It captures the content within the Value="..." attribute and replaces the entire line with just this captured content.
  • base64 --decode: This decodes the base64 value.

Note about failing pipeline for iOS

The iOS job failed for current branch, but error is following:

UnityException: iOS Version has not been set up correctly, it must consist only of '.'s and numbers, must begin and end with a number and be no longer than 18 characters the currently set version string "add-support-for-v3-images-1143079672-5959541012" is longer than 18 characters and doesn't start or end with a number and contains invalid characters. Please fix it in Player Settings.

This is pretty much self-explanatory, we probably have to change something in the build script as "it must consist only of '.'s and numbers, must begin and end with a number and be no longer than 18 characters". Not sure what's the best way to fix this, but might be out of scope for this branch.

Other workflows are considered to be working 🎉

CleanShot_2024-01-18_at_11.19.03_2x

Edited by Gabriel Le Breton

Merge request reports