Skip to content

Commit 1d05eb8

Browse files
unity-cli@v1.6.3 (#50)
- added `editor-logs` command to print the path to the unity editor logs directory - updated docs
1 parent da4262c commit 1d05eb8

File tree

5 files changed

+61
-24
lines changed

5 files changed

+61
-24
lines changed

README.md

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,21 @@ A powerful command line utility for the Unity Game Engine. Automate Unity projec
1414
- [License Version](#license-version)
1515
- [Activate License](#activate-license)
1616
- [Return License](#return-license)
17+
- [License Context](#license-context)
18+
- [Licensing Logs](#licensing-logs)
1719
- [Unity Hub](#unity-hub)
1820
- [Hub Version](#hub-version)
1921
- [Hub Path](#hub-path)
2022
- [Unity Hub Install](#unity-hub-install)
2123
- [Run Unity Hub Commands](#run-unity-hub-commands)
22-
- [Unity Editor](#unity-editor)
2324
- [Setup Unity Editor](#setup-unity-editor)
2425
- [Uninstall Unity Editor](#uninstall-unity-editor)
26+
- [Unity Editor](#unity-editor)
27+
- [Run Unity Editor Commands](#run-unity-editor-commands)
2528
- [List Project Templates](#list-project-templates)
2629
- [Create Unity Project](#create-unity-project)
2730
- [Open Unity Project](#open-unity-project)
28-
- [Run Unity Editor Commands](#run-unity-editor-commands)
31+
- [Unity Editor Logs](#unity-editor-logs)
2932
- [Unity Package Manager](#unity-package-manager)
3033
- [Sign a Unity Package](#sign-a-unity-package)
3134
- [Logging](#logging)
@@ -110,15 +113,15 @@ unity-cli activate-license --license personal --email <your-email> --password <y
110113
unity-cli return-license --license personal
111114
```
112115

113-
#### License Context
116+
##### License Context
114117

115118
`license-context`: Prints the current license context information.
116119

117120
```bash
118121
unity-cli license-context
119122
```
120123

121-
#### Licensing Logs
124+
##### Licensing Logs
122125

123126
`licensing-logs`: Prints the path to the Unity Licensing Client log files.
124127

@@ -177,8 +180,6 @@ Gets a list of installed editors:
177180
unity-cli hub editors --installed
178181
```
179182

180-
#### Unity Editor
181-
182183
##### Setup Unity Editor
183184

184185
`setup-unity [options]`: Find or install the Unity Editor for a project or specific version.
@@ -213,6 +214,28 @@ unity-cli setup-unity --unity-version 6000 --modules android,ios
213214
unity-cli uninstall-unity --unity-version 6000
214215
```
215216

217+
#### Unity Editor
218+
219+
##### Run Unity Editor Commands
220+
221+
`run [options] <args...>`: Run Unity Editor command line arguments (passes args directly to the editor).
222+
223+
- `--unity-editor <unityEditor>` The path to the Unity Editor executable. If unspecified, `--unity-project` or the `UNITY_EDITOR_PATH` environment variable must be set.
224+
- `--unity-project <unityProject>` The path to a Unity project. If unspecified, the `UNITY_PROJECT_PATH` environment variable will be used, otherwise no project will be specified.
225+
- `--log-name <logName>` The name of the log file.
226+
- `--log-level <logLevel>` Override the logger verbosity (`debug`, `info`, `minimal`, `warning`, `error`). Defaults to `info`.
227+
- `--verbose` Enable verbose logging. (Deprecated, use `--log-level <value>` instead)
228+
- `<args...>` Arguments to pass directly to the Unity Editor executable.
229+
230+
> [!NOTE]
231+
> When setting the `--log-level` option to `minimal`, only the unity telemetry logs will be shown in the console output. All other logs will be written to the log file. This option is only supported when running the command locally in the terminal. ***This options is still experimental and may change in future releases.***
232+
>
233+
> When running in CI environments the logger will automatically print the full logs to the console no matter the log level.
234+
235+
```bash
236+
unity-cli run --unity-project <path-to-project> -quit -batchmode -executeMethod StartCommandLineBuild
237+
```
238+
216239
##### List Project Templates
217240

218241
> [!NOTE]
@@ -274,24 +297,12 @@ unity-cli open-project --unity-project <path-to-project> --unity-version 6000 --
274297
unity-cli open-project
275298
```
276299

277-
##### Run Unity Editor Commands
300+
##### Unity Editor Logs
278301

279-
`run [options] <args...>`: Run Unity Editor command line arguments (passes args directly to the editor).
280-
281-
- `--unity-editor <unityEditor>` The path to the Unity Editor executable. If unspecified, `--unity-project` or the `UNITY_EDITOR_PATH` environment variable must be set.
282-
- `--unity-project <unityProject>` The path to a Unity project. If unspecified, the `UNITY_PROJECT_PATH` environment variable will be used, otherwise no project will be specified.
283-
- `--log-name <logName>` The name of the log file.
284-
- `--log-level <logLevel>` Override the logger verbosity (`debug`, `info`, `minimal`, `warning`, `error`). Defaults to `info`.
285-
- `--verbose` Enable verbose logging. (Deprecated, use `--log-level <value>` instead)
286-
- `<args...>` Arguments to pass directly to the Unity Editor executable.
287-
288-
> [!NOTE]
289-
> When setting the `--log-level` option to `minimal`, only the unity telemetry logs will be shown in the console output. All other logs will be written to the log file. This option is only supported when running the command locally in the terminal. ***This options is still experimental and may change in future releases.***
290-
>
291-
> When running in CI environments the logger will automatically print the full logs to the console no matter the log level.
302+
`editor-logs`: Prints the path to the Unity Editor log files.
292303

293304
```bash
294-
unity-cli run --unity-project <path-to-project> -quit -batchmode -executeMethod StartCommandLineBuild
305+
unity-cli editor-logs
295306
```
296307

297308
#### Unity Package Manager

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.6.2",
3+
"version": "1.6.3",
44
"description": "A command line utility for the Unity Game Engine.",
55
"author": "RageAgainstThePixel",
66
"license": "MIT",

src/cli.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,14 @@ program.command('open-project')
688688
}
689689
});
690690

691+
program.command('editor-logs')
692+
.description('Prints the path to the Unity Editor log files.')
693+
.action(async (options) => {
694+
const unityEditorLogsPath = UnityEditor.GetEditorLogsDirectory();
695+
process.stdout.write(`${unityEditorLogsPath}\n`);
696+
process.exit(0);
697+
});
698+
691699
program.commandsGroup("Unity Package Manager:");
692700

693701
program.command('sign-package')

src/unity-editor.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as os from 'os';
12
import * as fs from 'fs';
23
import * as path from 'path';
34
import { Logger } from './logging';
@@ -446,6 +447,23 @@ export class UnityEditor {
446447
return editorRootPath;
447448
}
448449

450+
/**
451+
* Gets the path to the Unity Editor log directory.
452+
* @returns The path to the Unity Editor logs directory.
453+
*/
454+
static GetEditorLogsDirectory() {
455+
switch (process.platform) {
456+
case 'darwin':
457+
return path.join(os.homedir(), 'Library', 'Logs', 'Unity');
458+
case 'linux':
459+
return path.join(os.homedir(), '.config', 'unity3d', 'Editor');
460+
case 'win32':
461+
return path.join(process.env.LOCALAPPDATA || '', 'Unity', 'Editor');
462+
default:
463+
throw new Error(`Unsupported platform: ${process.platform}`);
464+
}
465+
}
466+
449467
/**
450468
* Uninstall the Unity Editor.
451469
*/

0 commit comments

Comments
 (0)