Skip to content

Commit b8339c3

Browse files
unity-cli@v1.2.1 (#21)
- Hotfix to install libssl 1.1.1 for 2021.x editors - Added a new `uninstall-unity` command to uninstall unity editors by path or by version. - Added a new `open-project` command to launch a Unity project directly from the CLI, automatically resolving the Unity version and editor path. - Refactored command options for `run`, `list-project-templates`, and `create-project` to support both Unity version and editor path resolution, with clearer error handling if neither is specified - Refactored command options for `run`, `list-project-templates`, and `create-project` to support both Unity version and editor path resolution, with clearer error handling if neither is specified
1 parent 51a2b48 commit b8339c3

13 files changed

Lines changed: 413 additions & 157 deletions

.github/workflows/build-options.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"macos-latest"
66
],
77
"unity-version": [
8-
"2022.3.x",
8+
"4.7.2",
9+
"2021.x",
10+
"2022.x",
911
"6000.0.x",
1012
"6000.1.x",
1113
"6000.2.x"
@@ -23,5 +25,15 @@
2325
"os": "macos-latest",
2426
"build-target": "StandaloneOSX"
2527
}
28+
],
29+
"exclude": [
30+
{
31+
"os": "ubuntu-latest",
32+
"unity-version": "4.7.2"
33+
},
34+
{
35+
"os": "macos-latest",
36+
"unity-version": "4.7.2"
37+
}
2638
]
2739
}

.github/workflows/unity-build.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
permissions:
2323
contents: read
2424
timeout-minutes: 30
25+
env:
26+
UNITY_PROJECT_PATH: '' # Set from create-project step
2527
steps:
2628
- uses: actions/checkout@v4
2729
- uses: actions/setup-node@v4
@@ -38,7 +40,6 @@ jobs:
3840
shell: bash
3941
run: |
4042
unity-cli hub-install --auto-update
41-
unity-cli activate-license --license personal --email "${{ secrets.UNITY_USERNAME }}" --password "${{ secrets.UNITY_PASSWORD }}"
4243
unity-cli setup-unity --unity-version "${{ matrix.unity-version }}" --build-targets "${{ matrix.build-target }}" --json
4344
- name: verify UNITY_HUB_PATH and UNITY_EDITOR_PATH variables
4445
shell: bash
@@ -56,6 +57,10 @@ jobs:
5657
echo "Error: UNITY_EDITOR_PATH is not set"
5758
exit 1
5859
fi
60+
- name: activate license
61+
shell: bash
62+
run: |
63+
unity-cli activate-license --license personal --email "${{ secrets.UNITY_USERNAME }}" --password "${{ secrets.UNITY_PASSWORD }}"
5964
- name: create unity project
6065
shell: bash
6166
run: |
@@ -70,16 +75,26 @@ jobs:
7075
fi
7176
- name: Install OpenUPM and build pipeline package
7277
shell: bash
78+
if: ${{ matrix.unity-version != '4.7.2' && matrix.unity-version != '5.6.7' }}
7379
run: |
7480
npm install -g openupm-cli
7581
cd "${UNITY_PROJECT_PATH}"
7682
openupm add com.utilities.buildpipeline
7783
- name: Build project
84+
if: ${{ matrix.unity-version != '4.7.2' && matrix.unity-version != '5.6.7' }}
7885
shell: bash
7986
run: |
80-
unity-cli run --unity-editor "${UNITY_EDITOR_PATH}" --unity-project "${UNITY_PROJECT_PATH}" --log-name Validate -quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject -importTMProEssentialsAsset
81-
unity-cli run --unity-editor "${UNITY_EDITOR_PATH}" --unity-project "${UNITY_PROJECT_PATH}" --log-name Build -quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild -sceneList Assets/Scenes/SampleScene.unity
82-
- name: Post Run
87+
unity-cli run --log-name Validate -quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject -importTMProEssentialsAsset
88+
unity-cli run --log-name Build -quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild -sceneList Assets/Scenes/SampleScene.unity
89+
- name: Uninstall editor
90+
shell: bash
91+
run: |
92+
if [ -z "${UNITY_EDITOR_PATH}" ]; then
93+
echo "UNITY_EDITOR_PATH is not set, skipping uninstall"
94+
exit 0
95+
fi
96+
unity-cli uninstall-unity --unity-editor "${UNITY_EDITOR_PATH}"
97+
- name: Return license
8398
if: always()
8499
shell: bash
85100
run: |

README.md

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,29 @@ unity-cli [command] [options]
2828

2929
### Common Commands
3030

31-
- `unity-cli hub-install`: Install Unity Hub
32-
- `unity-cli hub-version`: Print Unity Hub version
33-
- `unity-cli hub-path`: Print Unity Hub executable path
34-
- `unity-cli hub [options] <args...>`: Run [Unity Hub command line arguments](https://docs.unity3d.com/hub/manual/HubCLI.html)
31+
#### Auth
32+
33+
- `unity-cli license-version`: Print the Unity License Client version
3534
- `unity-cli activate-license [options]`: Activate a Unity license
3635
- `unity-cli return-license [options]`: Return a Unity license
37-
- `unity-cli license-version`: Print Unity License Client version
38-
- `unity-cli setup-unity [options]`: Find or install Unity Editor for a project/version
39-
- `unity-cli create-project [options]`: Create a new Unity project from a [template](https://docs.unity3d.com/hub/manual/Templates.html)
40-
- `unity-cli run [options] <args...>`: Run [Unity Editor Command Line Arguments](https://docs.unity3d.com/Manual/EditorCommandLineArguments.html)
36+
37+
#### Unity Hub
38+
39+
- `unity-cli hub-version`: Print the Unity Hub version
40+
- `unity-cli hub-install [options]`: Install or update the Unity Hub
41+
- `unity-cli hub-path`: Print the Unity Hub executable path
42+
- `unity-cli hub [options] <args...>`: Run Unity Hub command line arguments (passes args directly to the hub executable)
43+
44+
#### Unity Editor
45+
46+
- `unity-cli setup-unity [options]`: Find or install the Unity Editor for a project or specific version
47+
- `unity-cli uninstall-unity [options]`: Uninstall a Unity Editor version
48+
- `unity-cli list-project-templates [options]`: List available Unity project templates for an editor
49+
- `unity-cli create-project [options]`: Create a new Unity project from a template
50+
- `unity-cli open-project [options]`: Open a Unity project in the Unity Editor
51+
- `unity-cli run [options] <args...>`: Run Unity Editor command line arguments (passes args directly to the editor)
52+
53+
Run `unity-cli --help` for a full list of commands and options.
4154

4255
#### Install Unity Hub and Editor
4356

@@ -60,8 +73,16 @@ unity-cli activate-license --email <your-email> --password <your-password> --ser
6073
unity-cli create-project --name "MyGame" --template com.unity.template.3d(-cross-platform)? --unity-editor <path-to-editor>
6174
```
6275

76+
#### Open a project from the command line
77+
78+
> [!NOTE] If you run this command in the same directory as your Unity project, you can omit the `--unity-project`, `--unity-version`, and `--unity-editor` options.
79+
80+
```bash
81+
unity-cli open-project
82+
```
83+
6384
#### Build a Project
6485

6586
```bash
66-
unity-cli run --unity-editor <path-to-editor> --unity-project <path-to-project> -quit -batchmode -executeMethod StartCommandLineBuild
87+
unity-cli run --unity-project <path-to-project> -quit -batchmode -executeMethod StartCommandLineBuild
6788
```

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rage-against-the-pixel/unity-cli",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"description": "A command line utility for the Unity Game Engine.",
55
"author": "RageAgainstThePixel",
66
"license": "MIT",

0 commit comments

Comments
 (0)