Skip to content

Commit 96500e8

Browse files
authored
Merge branch 'main' into main
2 parents edef4fa + 92691c9 commit 96500e8

File tree

9 files changed

+368
-241
lines changed

9 files changed

+368
-241
lines changed

docs/03-github/02-activation.mdx

Lines changed: 59 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,81 @@
1+
import unityHubPreferencesLicensesAddButton from '/assets/images/unity-hub-preferences-licenses-add-button.png';
2+
13
# Activation
24

3-
All actions use a Unity installation, which needs to be activated.
5+
All Unity actions require activation.
6+
7+
### Choosing the Right Activation Method
8+
9+
To activate Unity, select the method that matches your license type:
410

5-
Unity differentiates their methods between `personal` and `professional` licenses.
11+
- If you're using the **free version**, follow the steps for a
12+
[Personal License](#personal-license).
13+
- If you're using the **paid version**, such as Unity Plus or Pro, refer to the instructions for a
14+
[Professional License](#professional-license).
15+
- For organizations using a **license server**, you can provide the server's URL as detailed in the
16+
[License Server](#license-server) section.
617

7-
Depending on whether you are using a free or paid version of Unity, you will need to follow the
8-
steps for either a [personal license](#personal-license) or a
9-
[professional license](#professional-license). Alternatively you can provide the url to a
10-
[License server](#license-server).
18+
Choose the appropriate method to ensure your Unity environment is activated and ready for use.
1119

1220
## Personal license
1321

14-
Follow these steps if you are using a free version of Unity.
22+
Follow these steps if you are using the free version of Unity.
1523

16-
> _**Note:** Do NOT follow the steps for the personal license if you have a professional license._
24+
> _**Note:** Do not follow the steps for the personal license if you have a professional license._
25+
26+
### Mental Model
27+
28+
1. **Activate the license locally**: Use Unity Hub to create a `.ulf` license file linked to your
29+
Unity account.
30+
2. **Add the license to GitHub**: Store the `.ulf` file and Unity credentials as GitHub secrets for
31+
use in CI builds.
1732

18-
#### Mental model
33+
### Setting Up Your Unity License
1934

20-
1. Activate a license for use on Github via a local machine
21-
2. Set the license as a secret
35+
1. **Install Unity Hub**: Download and install [Unity Hub](https://unity.com/download) on your local
36+
machine.
37+
2. **Log in to Unity Hub**: Use the Unity account linked to your CI setup to log in. Ensure you're
38+
using the correct account to activate the intended license.
39+
3. **Activate Your License**: Manually activate by navigating to:
2240

23-
#### Activating a license file
41+
- `Unity Hub` > `Preferences` > `Licenses` and click the `Add` button
42+
- Select **Get a free personal license**.
2443

25-
1. Install [Unity Hub](https://unity.com/download) on your local machine.
26-
2. Log into Unity Hub with the Unity account that you are using for CI. Make sure you log into the
27-
correct account or you may not activate the correct license.
28-
3. When prompted, activate your personal license. If you are not prompted, go to `Unity Hub` >
29-
`Preferences` > `Licenses` > `Add` and choose `Get a free personal license`. You do not need to
30-
install an editor on your local machine.
31-
4. Depending on the host you are using, find the `.ulf` file which is your Unity license in the
32-
following paths:
44+
:::info Ensure File Creation
45+
46+
Even if a license appears in Unity Hub, a `.ulf` file may not have been created. To ensure the
47+
file is generated, make sure to click the `Add` button and proceed with the activation steps. Do
48+
not skip this step.
49+
50+
<img
51+
src={unityHubPreferencesLicensesAddButton}
52+
alt="Unity Hub interface showing the Preferences window with the Licenses tab selected and the Add button highlighted"
53+
/>
54+
55+
4. **Locate the `.ulf` file**: Depending on your operating system, the Unity license file will be
56+
located in one of these paths:
3357

3458
- Windows: `C:\ProgramData\Unity\Unity_lic.ulf`
3559
- Mac: `/Library/Application Support/Unity/Unity_lic.ulf`
3660
- Linux: `~/.local/share/unity3d/Unity/Unity_lic.ulf`
3761

38-
If you have issues locating the file, ensure you've logged into Unity Hub AND activated your
39-
license. Otherwise the file will not be present. Keep in mind these folders might be hidden by
40-
default, you may need to reveal hidden files to see them.
62+
If you have trouble locating the `.ulf` file, follow these steps:
4163

42-
> **Note:** The host platform you use to activate the license does not matter. You only need to
43-
> get the ulf from the platform that is most convenient to you. For example, using Windows to
44-
> activate your license and building on Ubuntu on Github is perfectly fine.
64+
- **Check activation**: Ensure you’ve logged into Unity Hub and completed the step "3. Activate
65+
Your License".
66+
- **Reveal hidden files**: These folders may be hidden by default, so enable the option to view
67+
hidden files in your file explorer.
68+
- **Use any platform**: Licenses are not tied to a specific Unity version or platform. You can
69+
activate the license on any operating system, such as Windows, and use it for builds on another
70+
platform, like Ubuntu. Simply retrieve the `.ulf` file from the platform most convenient for
71+
you.
4572

46-
5. Open `Github` > `<Your repository>` > `Settings` > `Secrets and Variables` > `Actions`.
47-
6. Create the following secrets;
48-
- `UNITY_LICENSE` - _(Copy the contents of your license file into here)_
49-
- `UNITY_EMAIL` - _(Add the email address that you use to login to Unity)_
50-
- `UNITY_PASSWORD` - _(Add the password that you use to login to Unity)_
51-
7. Return your personal license in Unity Hub on the local machine you used to ensure you aren't
52-
using up one of the seats. You can do this by going to `Unity Hub` > `Preferences` > `Licenses`
53-
and choose `Return license` on the Personal license listed in the window.
73+
5. **Add Secrets to GitHub**: Navigate to `GitHub` > `<Your repository>` > `Settings` >
74+
`Secrets and Variables` > `Actions`. Then, create the following secrets:
75+
76+
- **`UNITY_LICENSE`**: Copy and paste the contents of your `.ulf` license file
77+
- **`UNITY_EMAIL`**: Enter the email address associated with your Unity account
78+
- **`UNITY_PASSWORD`**: Enter the password for your Unity account
5479

5580
**GameCI does not acquire nor store your Unity email, password, or license file contents. They are
5681
required for activating the license during build and test steps.**

docs/03-github/04-builder.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,10 +644,10 @@ using `sshPublicKeysDirectoryPath` and setting the `GIT_CONFIG_EXTENSIONS` envir
644644
```yaml
645645
- uses: webfactory/ssh-agent@v0.8.0
646646
with:
647-
ssh-private-key: |
648-
${{ secrets.FIRST_KEY }}
649-
${{ secrets.NEXT_KEY }}
650-
${{ secrets.ANOTHER_KEY }}
647+
ssh-private-key: |
648+
${{ secrets.FIRST_KEY }}
649+
${{ secrets.NEXT_KEY }}
650+
${{ secrets.ANOTHER_KEY }}
651651
652652
- name: Prepare SSH config for unity builder
653653
run: |

docs/05-gitlab/01-getting-started.mdx

Lines changed: 77 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ gitlab using gitlab-ci.
88
## Overall steps
99

1010
1. Understand how [gitlab-ci](https://docs.gitlab.com/ce/ci/) works.
11-
2. Configure a license for Unity.
12-
3. Add build scripts and integrations in your Unity project
13-
4. Set up a gitlab-ci pipeline for your project.
14-
5. Result: Accept merge requests with more confidence.
11+
2. Add build scripts and gitlab-ci integration in your Unity project
12+
3. Configure a license for Unity.
13+
4. Successfully build and test your Unity project 🎉
1514

1615
## First time using Gitlab CI?
1716

@@ -22,55 +21,96 @@ Any subsequent steps assume you have read the above.
2221

2322
## Supported versions
2423

25-
The [unity3d-gitlab-ci-example project](https://gitlab.com/game-ci/unity3d-gitlab-ci-example/) is
26-
based on [unity3d](https://github.com/game-ci/docker/) docker images from
27-
[game-ci](https://github.com/game-ci). Any version in the
28-
[docker hub `unityci/editor` tags list](https://hub.docker.com/r/unityci/editor/tags) can be used to
29-
test and build projects.
24+
The [unity3d-gitlab-ci-example project](https://gitlab.com/game-ci/unity3d-gitlab-ci-example/) uses
25+
[unity3d docker images](https://github.com/game-ci/docker/) published by
26+
[game-ci](https://github.com/game-ci).
3027

31-
It's generally considered good practice to use the same Unity version for your CI/CD setup as you do
32-
to develop your project.
28+
:::tip
29+
30+
Before proceeding, verify that your Unity version is supported by checking the
31+
[Docker > Versions page](/docs/docker/versions).
32+
33+
:::
34+
35+
It is generally considered good practice to use the same Unity version for your CI/CD setup as you
36+
do to develop your project. Our Gitlab CI configuration will automatically detect and use the
37+
correct Unity version for your project.
3338

3439
## Video tutorial
3540

3641
<Video url="https://www.youtube-nocookie.com/embed/k0NcedDzEqA" />
3742

38-
## Setting up gitlab-ci for your Unity project
43+
:::caution
44+
45+
The video (recorded with Unity 2020.x) is slightly outdated, but the general concepts are still the
46+
same. 👍
47+
48+
- The activation process has changed a bit since then.
49+
- Docker images have been updated
50+
- The `.gitlab-ci.yml` file uses different variables now.
51+
52+
:::
53+
54+
### Steps to Set Up Unity CI/CD with GitLab
55+
56+
#### 1. Clone the Example Repository
57+
58+
Start by cloning the GameCI example project provided by GameCI to use its configuration files.
59+
60+
```bash
61+
git clone https://gitlab.com/game-ci/unity3d-gitlab-ci-example.git
62+
```
63+
64+
#### 2. (Optional) Checkout a Specific Version
65+
66+
If you want to use a specific version of the example project, checkout the desired tag.
67+
68+
```bash
69+
cd unity3d-gitlab-ci-example
70+
git checkout v4.0.0
71+
cd ..
72+
```
73+
74+
:::info
75+
76+
See [example project's release](https://gitlab.com/game-ci/unity3d-gitlab-ci-example/-/releases) for
77+
stable versions.
3978

40-
### I don't have a Unity project yet
79+
:::
4180

42-
1. Fork
43-
[the unity3d-gitlab-ci-example project](https://gitlab.com/game-ci/unity3d-gitlab-ci-example/)
44-
1. Clone the fork you just created locally
45-
1. Continue to activation instructions
81+
#### 3. Navigate to Your Unity Project
4682

47-
### I already have my own Unity project
83+
Replace `your-unity-project` with the actual name of your Unity project folder.
4884

49-
1. Clone
50-
[the unity3d-gitlab-ci-example project](https://gitlab.com/game-ci/unity3d-gitlab-ci-example/)
51-
1. Copy
52-
[`.gitlab-ci.yml`](https://gitlab.com/game-ci/unity3d-gitlab-ci-example/-/blob/main/.gitlab-ci.yml)
53-
to the root of your repository,
54-
[`Assets/Scripts/Editor/BuildCommand.cs`](https://gitlab.com/game-ci/unity3d-gitlab-ci-example/-/blob/main/Assets/Scripts/Editor/BuildCommand.cs)
55-
and [`ci` folder](https://gitlab.com/game-ci/unity3d-gitlab-ci-example/-/blob/main/ci) to your
56-
project:
85+
```bash
86+
cd your-unity-project
87+
```
5788

58-
Assuming you've cloned the example project in the parent folder of your project, and your Unity
59-
project is at the root of your repository, execute these commands from the root folder of your
60-
project:
89+
#### 4. Create Necessary Directories
90+
91+
Create the required directories in your Unity project to hold CI-related files.
6192

6293
```bash
6394
mkdir -p Assets/Scripts/Editor/
95+
```
96+
97+
#### 5. Copy Required Files
98+
99+
Copy the necessary CI configuration and scripts from the example project to your Unity project.
100+
101+
```bash
64102
cp ../unity3d-gitlab-ci-example/.gitlab-ci.yml ./
65103
cp -r ../unity3d-gitlab-ci-example/ci ./
66104
cp ../unity3d-gitlab-ci-example/Assets/Scripts/Editor/BuildCommand.cs ./Assets/Scripts/Editor/
67105
```
68106

69-
1. Open and edit the
70-
[`.gitlab-ci.yml`](https://gitlab.com/game-ci/unity3d-gitlab-ci-example/-/blob/main/.gitlab-ci.yml)
71-
you copied to your project and update
72-
[the variables](https://gitlab.com/game-ci/unity3d-gitlab-ci-example/-/blob/main/.gitlab-ci.yml#L7-13)
73-
with the versions you need. Your Unity project version can be found in
74-
`ProjectSettings/ProjectVersion.txt`.
75-
1. If your Unity project is not at the root of your repository, also update UNITY_DIR variable.
76-
1. Continue to activation instructions
107+
#### Final Note:
108+
109+
If your Unity project is not at the root of your repository, update the paths accordingly in the
110+
commands above and in the `.gitlab-ci.yml` file. Adjust the `UNITY_DIR` variable in `.gitlab-ci.yml`
111+
to point to your project directory.
112+
113+
## Proceed to activation
114+
115+
That’s It! You're one step away from having automated builds and tests for your Unity project.
116+
Proceed to the [Activation](./02-activation.mdx) guide.

0 commit comments

Comments
 (0)