From baef580557a46df6ba5481cf72b824bba2e29c75 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 11:18:57 -0500 Subject: [PATCH 1/2] unity-cli@v1.6.3 - added `editor-logs` command to print the path to the unity editor logs directory - updated docs --- README.md | 11 +++++++++++ package-lock.json | 4 ++-- package.json | 2 +- src/cli.ts | 8 ++++++++ src/unity-editor.ts | 17 +++++++++++++++++ 5 files changed, 39 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8d096cb..6433128 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ A powerful command line utility for the Unity Game Engine. Automate Unity projec - [License Version](#license-version) - [Activate License](#activate-license) - [Return License](#return-license) + - [License Context](#license-context) + - [Licensing Logs](#licensing-logs) - [Unity Hub](#unity-hub) - [Hub Version](#hub-version) - [Hub Path](#hub-path) @@ -26,6 +28,7 @@ A powerful command line utility for the Unity Game Engine. Automate Unity projec - [Create Unity Project](#create-unity-project) - [Open Unity Project](#open-unity-project) - [Run Unity Editor Commands](#run-unity-editor-commands) + - [Unity Editor Logs](#unity-editor-logs) - [Unity Package Manager](#unity-package-manager) - [Sign a Unity Package](#sign-a-unity-package) - [Logging](#logging) @@ -294,6 +297,14 @@ unity-cli open-project unity-cli run --unity-project -quit -batchmode -executeMethod StartCommandLineBuild ``` +#### Unity Editor Logs + +`editor-logs`: Prints the path to the Unity Editor log files. + +```bash +unity-cli editor-logs +``` + #### Unity Package Manager ##### Sign a Unity Package diff --git a/package-lock.json b/package-lock.json index 056f0e1..b517890 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@rage-against-the-pixel/unity-cli", - "version": "1.6.2", + "version": "1.6.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@rage-against-the-pixel/unity-cli", - "version": "1.6.2", + "version": "1.6.3", "license": "MIT", "dependencies": { "@electron/asar": "^4.0.1", diff --git a/package.json b/package.json index 09a0b05..27bb3c6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rage-against-the-pixel/unity-cli", - "version": "1.6.2", + "version": "1.6.3", "description": "A command line utility for the Unity Game Engine.", "author": "RageAgainstThePixel", "license": "MIT", diff --git a/src/cli.ts b/src/cli.ts index 4ea39f5..f88837d 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -688,6 +688,14 @@ program.command('open-project') } }); +program.command('editor-logs') + .description('Prints the path to the Unity Editor log files.') + .action(async (options) => { + const unityEditorLogsPath = UnityEditor.GetEditorLogsDirectory(); + process.stdout.write(`${unityEditorLogsPath}\n`); + process.exit(0); + }); + program.commandsGroup("Unity Package Manager:"); program.command('sign-package') diff --git a/src/unity-editor.ts b/src/unity-editor.ts index 371654c..e055a31 100644 --- a/src/unity-editor.ts +++ b/src/unity-editor.ts @@ -446,6 +446,23 @@ export class UnityEditor { return editorRootPath; } + /** + * Gets the path to the Unity Editor log directory. + * @returns The path to the Unity Editor logs directory. + */ + static GetEditorLogsDirectory() { + switch (process.platform) { + case 'darwin': + return path.join(process.env.HOME || '', 'Library', 'Logs', 'Unity'); + case 'linux': + return path.join(process.env.HOME || '', '.config', 'unity3d', 'Editor'); + case 'win32': + return path.join(process.env.LOCALAPPDATA || '', 'Unity', 'Editor'); + default: + throw new Error(`Unsupported platform: ${process.platform}`); + } + } + /** * Uninstall the Unity Editor. */ From 95a88985b4a65b292ac04dd5854b79729b6a98b2 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 11:26:36 -0500 Subject: [PATCH 2/2] PR review --- README.md | 54 ++++++++++++++++++++++----------------------- src/unity-editor.ts | 5 +++-- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 6433128..286f52c 100644 --- a/README.md +++ b/README.md @@ -21,13 +21,13 @@ A powerful command line utility for the Unity Game Engine. Automate Unity projec - [Hub Path](#hub-path) - [Unity Hub Install](#unity-hub-install) - [Run Unity Hub Commands](#run-unity-hub-commands) - - [Unity Editor](#unity-editor) - [Setup Unity Editor](#setup-unity-editor) - [Uninstall Unity Editor](#uninstall-unity-editor) + - [Unity Editor](#unity-editor) + - [Run Unity Editor Commands](#run-unity-editor-commands) - [List Project Templates](#list-project-templates) - [Create Unity Project](#create-unity-project) - [Open Unity Project](#open-unity-project) - - [Run Unity Editor Commands](#run-unity-editor-commands) - [Unity Editor Logs](#unity-editor-logs) - [Unity Package Manager](#unity-package-manager) - [Sign a Unity Package](#sign-a-unity-package) @@ -113,7 +113,7 @@ unity-cli activate-license --license personal --email --password `: Run Unity Editor command line arguments (passes args directly to the editor). + +- `--unity-editor ` The path to the Unity Editor executable. If unspecified, `--unity-project` or the `UNITY_EDITOR_PATH` environment variable must be set. +- `--unity-project ` The path to a Unity project. If unspecified, the `UNITY_PROJECT_PATH` environment variable will be used, otherwise no project will be specified. +- `--log-name ` The name of the log file. +- `--log-level ` Override the logger verbosity (`debug`, `info`, `minimal`, `warning`, `error`). Defaults to `info`. +- `--verbose` Enable verbose logging. (Deprecated, use `--log-level ` instead) +- `` Arguments to pass directly to the Unity Editor executable. + +> [!NOTE] +> 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.*** +> +> When running in CI environments the logger will automatically print the full logs to the console no matter the log level. + +```bash +unity-cli run --unity-project -quit -batchmode -executeMethod StartCommandLineBuild +``` + ##### List Project Templates > [!NOTE] @@ -277,27 +297,7 @@ unity-cli open-project --unity-project --unity-version 6000 -- unity-cli open-project ``` -##### Run Unity Editor Commands - -`run [options] `: Run Unity Editor command line arguments (passes args directly to the editor). - -- `--unity-editor ` The path to the Unity Editor executable. If unspecified, `--unity-project` or the `UNITY_EDITOR_PATH` environment variable must be set. -- `--unity-project ` The path to a Unity project. If unspecified, the `UNITY_PROJECT_PATH` environment variable will be used, otherwise no project will be specified. -- `--log-name ` The name of the log file. -- `--log-level ` Override the logger verbosity (`debug`, `info`, `minimal`, `warning`, `error`). Defaults to `info`. -- `--verbose` Enable verbose logging. (Deprecated, use `--log-level ` instead) -- `` Arguments to pass directly to the Unity Editor executable. - -> [!NOTE] -> 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.*** -> -> When running in CI environments the logger will automatically print the full logs to the console no matter the log level. - -```bash -unity-cli run --unity-project -quit -batchmode -executeMethod StartCommandLineBuild -``` - -#### Unity Editor Logs +##### Unity Editor Logs `editor-logs`: Prints the path to the Unity Editor log files. diff --git a/src/unity-editor.ts b/src/unity-editor.ts index e055a31..b3cd81f 100644 --- a/src/unity-editor.ts +++ b/src/unity-editor.ts @@ -1,3 +1,4 @@ +import * as os from 'os'; import * as fs from 'fs'; import * as path from 'path'; import { Logger } from './logging'; @@ -453,9 +454,9 @@ export class UnityEditor { static GetEditorLogsDirectory() { switch (process.platform) { case 'darwin': - return path.join(process.env.HOME || '', 'Library', 'Logs', 'Unity'); + return path.join(os.homedir(), 'Library', 'Logs', 'Unity'); case 'linux': - return path.join(process.env.HOME || '', '.config', 'unity3d', 'Editor'); + return path.join(os.homedir(), '.config', 'unity3d', 'Editor'); case 'win32': return path.join(process.env.LOCALAPPDATA || '', 'Unity', 'Editor'); default: