From e721f9acdea987f5869bea2f614806cb8054a913 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 12:25:29 -0500 Subject: [PATCH 01/19] unity-cli@v1.6.5 - renamed `licensing-logs` command to `licensing-client-logs` - added `licensing-audit-logs` - added `hub-logs` --- README.md | 26 ++++++++++++++++++++++---- package.json | 2 +- src/cli.ts | 21 +++++++++++++++++---- src/license-client.ts | 23 ++++++++++++++++++++++- src/unity-hub.ts | 21 +++++++++++++++++++++ 5 files changed, 83 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 286f52c..8255cf7 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,12 @@ A powerful command line utility for the Unity Game Engine. Automate Unity projec - [Activate License](#activate-license) - [Return License](#return-license) - [License Context](#license-context) - - [Licensing Logs](#licensing-logs) + - [Licensing Client Logs](#licensing-client-logs) + - [Licensing Audit Logs](#licensing-audit-logs) - [Unity Hub](#unity-hub) - [Hub Version](#hub-version) - [Hub Path](#hub-path) + - [Hub Logs](#hub-logs) - [Unity Hub Install](#unity-hub-install) - [Run Unity Hub Commands](#run-unity-hub-commands) - [Setup Unity Editor](#setup-unity-editor) @@ -121,12 +123,20 @@ unity-cli return-license --license personal unity-cli license-context ``` -##### Licensing Logs +##### Licensing Client Logs -`licensing-logs`: Prints the path to the Unity Licensing Client log files. +`licensing-client-logs`: Prints the path to the Unity Licensing Client log file. ```bash -unity-cli licensing-logs +unity-cli licensing-client-logs +``` + +##### Licensing Audit Logs + +`licensing-audit-logs`: Prints the path to the Unity Licensing Client audit log. + +```bash +unity-cli licensing-audit-logs ``` #### Unity Hub @@ -147,6 +157,14 @@ unity-cli hub-version unity-cli hub-path ``` +##### Hub Logs + +`hub-logs`: Prints the path to the Unity Hub log file. + +```bash +unity-cli hub-logs +``` + ##### Unity Hub Install `hub-install [options]`: Install or update the Unity Hub diff --git a/package.json b/package.json index ae07168..34052d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rage-against-the-pixel/unity-cli", - "version": "1.6.4", + "version": "1.6.5", "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 f88837d..5ab19a4 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -148,11 +148,17 @@ program.command('license-context') process.exit(0); }); -program.command('licensing-logs') - .description('Prints the path to the Unity Licensing Client log files.') +program.command('licensing-client-logs') + .description('Prints the path to the Unity Licensing Client log file.') .action(async () => { - const client = new LicensingClient(); - process.stdout.write(`${client.logPath()}\n`); + process.stdout.write(`${LicensingClient.ClientLogPath()}\n`); + process.exit(0); + }); + +program.command('licensing-audit-logs') + .description('Prints the Unity Licensing Client audit log.') + .action(async () => { + process.stdout.write(`${LicensingClient.ClientAuditLogPath()}\n`); process.exit(0); }); @@ -189,6 +195,13 @@ program.command('hub-path') process.exit(0); }); +program.command('hub-logs') + .description('Prints the path to the Unity Hub log file.') + .action(async () => { + process.stdout.write(`${UnityHub.LogPath()}\n`); + process.exit(0); + }); + program.command('hub-install') .description('Install the Unity Hub.') .option('--verbose', 'Enable verbose logging.') diff --git a/src/license-client.ts b/src/license-client.ts index d266d60..f5a5cc8 100644 --- a/src/license-client.ts +++ b/src/license-client.ts @@ -124,7 +124,7 @@ export class LicensingClient { * @see https://docs.unity.com/en-us/licensing-server/troubleshooting-client#logs * @returns The path to the log file. */ - public logPath(): string { + public static ClientLogPath(): string { switch (process.platform) { case 'win32': // $env:LOCALAPPDATA\Unity\Unity.Licensing.Client.log @@ -140,6 +140,27 @@ export class LicensingClient { } } + /** + * Gets the path to the Unity Licensing Client audit log file. + * @see https://docs.unity.com/en-us/licensing-server/troubleshooting-client#logs + * @returns The path to the audit log file. + */ + public static ClientAuditLogPath(): string { + switch (process.platform) { + case 'win32': + // $env:LOCALAPPDATA\Unity\Unity.Entitlements.Audit.log + return path.join(process.env.LOCALAPPDATA || '', 'Unity', 'Unity.Entitlements.Audit.log'); + case 'darwin': + // ~/Library/Logs/Unity/Unity.Entitlements.Audit.log + return path.join(os.homedir(), 'Library', 'Logs', 'Unity', 'Unity.Entitlements.Audit.log'); + case 'linux': + // ~/.config/unity3d/Unity/Unity.Entitlements.Audit.log + return path.join(os.homedir(), '.config', 'unity3d', 'Unity', 'Unity.Entitlements.Audit.log'); + default: + throw new Error(`Unsupported platform: ${process.platform}`); + } + } + /** * Displays the context information of the licensing client to the console. * @see https://docs.unity.com/en-us/licensing-server/troubleshooting-client#exit-codes diff --git a/src/unity-hub.ts b/src/unity-hub.ts index b9b2373..94d4563 100644 --- a/src/unity-hub.ts +++ b/src/unity-hub.ts @@ -1258,4 +1258,25 @@ done return moduleMap; } + + /** + * Returns the path to the Unity Hub log file. + * @see https://docs.unity.com/en-us/licensing-server/troubleshooting-client#logs + * @returns The Unity Hub log file path. + */ + public static LogPath(): string { + switch (process.platform) { + case 'win32': + // %APPDATA%\UnityHub\logs\info-log.json + return path.join(process.env.APPDATA || '', 'UnityHub', 'logs', 'info-log.json'); + case 'darwin': + // ~/Library/Application Support/UnityHub/logs/info-log.json + return path.join(os.homedir(), 'Library', 'Application Support', 'UnityHub', 'logs', 'info-log.json'); + case 'linux': + // ~/.config/UnityHub/logs/info-log.json + return path.join(os.homedir(), '.config', 'UnityHub', 'logs', 'info-log.json'); + default: + throw new Error(`Unsupported platform: ${process.platform}`); + } + } } \ No newline at end of file From 4eac3ceb6341e615529fbe792c6eec873ddb1db2 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 12:28:25 -0500 Subject: [PATCH 02/19] PR reviews --- src/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.ts b/src/cli.ts index 5ab19a4..e26d614 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -156,7 +156,7 @@ program.command('licensing-client-logs') }); program.command('licensing-audit-logs') - .description('Prints the Unity Licensing Client audit log.') + .description('Prints the path to the Unity Licensing Client audit log file.') .action(async () => { process.stdout.write(`${LicensingClient.ClientAuditLogPath()}\n`); process.exit(0); From 8cbfdb5c33fcfddd94652294d839e30c5574990b Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 12:28:33 -0500 Subject: [PATCH 03/19] lock --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 03a1416..5347667 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@rage-against-the-pixel/unity-cli", - "version": "1.6.4", + "version": "1.6.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@rage-against-the-pixel/unity-cli", - "version": "1.6.4", + "version": "1.6.5", "license": "MIT", "dependencies": { "@electron/asar": "^4.0.1", From db7e2593bc679daffa9d9765d50e3a22237374d4 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 12:31:01 -0500 Subject: [PATCH 04/19] add validation tests --- .github/workflows/unity-build.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/unity-build.yml b/.github/workflows/unity-build.yml index 511635a..282bf92 100644 --- a/.github/workflows/unity-build.yml +++ b/.github/workflows/unity-build.yml @@ -74,6 +74,30 @@ jobs: shell: bash run: | unity-cli activate-license --license personal --email "${{ secrets.UNITY_USERNAME }}" --password "${{ secrets.UNITY_PASSWORD }}" + - name: Print log paths + shell: bash + run: | + HUB_LOG_PATH=$(unity-cli hub-logs) + LICENSING_CLIENT_LOG_PATH=$(unity-cli licensing-client-logs) + LICENSING_AUDIT_LOG_PATH=$(unity-cli licensing-audit-logs) + + echo "Hub Log Path: ${HUB_LOG_PATH}" + echo "Licensing Client Log Path: ${LICENSING_CLIENT_LOG_PATH}" + echo "Licensing Audit Log Path: ${LICENSING_AUDIT_LOG_PATH}" + + # verify that the log files exist + if [ ! -f "${LICENSING_CLIENT_LOG_PATH}" ]; then + echo "Error: Licensing Client log file does not exist at ${LICENSING_CLIENT_LOG_PATH}" + exit 1 + fi + if [ ! -f "${LICENSING_AUDIT_LOG_PATH}" ]; then + echo "Error: Licensing Audit log file does not exist at ${LICENSING_AUDIT_LOG_PATH}" + exit 1 + fi + if [ ! -f "${HUB_LOG_PATH}" ]; then + echo "Error: Hub log file does not exist at ${HUB_LOG_PATH}" + exit 1 + fi - name: Create Unity Project if : ${{ matrix.unity-version != 'none' }} shell: bash From b6b979a107b6ec69629de8a9a61018ddd769cbe0 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 12:34:51 -0500 Subject: [PATCH 05/19] space --- .github/workflows/unity-build.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unity-build.yml b/.github/workflows/unity-build.yml index 282bf92..6f3ab64 100644 --- a/.github/workflows/unity-build.yml +++ b/.github/workflows/unity-build.yml @@ -70,11 +70,12 @@ jobs: exit 1 fi - name: Activate License - if : ${{ matrix.unity-version != 'none' }} + if: ${{ matrix.unity-version != 'none' }} shell: bash run: | unity-cli activate-license --license personal --email "${{ secrets.UNITY_USERNAME }}" --password "${{ secrets.UNITY_PASSWORD }}" - name: Print log paths + if: ${{ matrix.unity-version != 'none' }} shell: bash run: | HUB_LOG_PATH=$(unity-cli hub-logs) @@ -99,13 +100,13 @@ jobs: exit 1 fi - name: Create Unity Project - if : ${{ matrix.unity-version != 'none' }} + if: ${{ matrix.unity-version != 'none' }} shell: bash run: | unity-cli list-project-templates --unity-editor "${UNITY_EDITOR_PATH}" --json unity-cli create-project --name "Unity Project" --unity-editor "${UNITY_EDITOR_PATH}" --json - name: Verify UNITY_PROJECT_PATH variable - if : ${{ matrix.unity-version != 'none' }} + if: ${{ matrix.unity-version != 'none' }} shell: bash run: | if [ -z "${UNITY_PROJECT_PATH}" ]; then From 1edea8751ce888c8bd03796a3a45fc416b434ddf Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 12:58:05 -0500 Subject: [PATCH 06/19] try different way to get home dir --- .github/workflows/unity-build.yml | 1 + src/unity-editor.ts | 5 ++--- src/unity-hub.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unity-build.yml b/.github/workflows/unity-build.yml index 6f3ab64..a697286 100644 --- a/.github/workflows/unity-build.yml +++ b/.github/workflows/unity-build.yml @@ -73,6 +73,7 @@ jobs: if: ${{ matrix.unity-version != 'none' }} shell: bash run: | + unity-cli license-context unity-cli activate-license --license personal --email "${{ secrets.UNITY_USERNAME }}" --password "${{ secrets.UNITY_PASSWORD }}" - name: Print log paths if: ${{ matrix.unity-version != 'none' }} diff --git a/src/unity-editor.ts b/src/unity-editor.ts index b3cd81f..e055a31 100644 --- a/src/unity-editor.ts +++ b/src/unity-editor.ts @@ -1,4 +1,3 @@ -import * as os from 'os'; import * as fs from 'fs'; import * as path from 'path'; import { Logger } from './logging'; @@ -454,9 +453,9 @@ export class UnityEditor { static GetEditorLogsDirectory() { switch (process.platform) { case 'darwin': - return path.join(os.homedir(), 'Library', 'Logs', 'Unity'); + return path.join(process.env.HOME || '', 'Library', 'Logs', 'Unity'); case 'linux': - return path.join(os.homedir(), '.config', 'unity3d', 'Editor'); + return path.join(process.env.HOME || '', '.config', 'unity3d', 'Editor'); case 'win32': return path.join(process.env.LOCALAPPDATA || '', 'Unity', 'Editor'); default: diff --git a/src/unity-hub.ts b/src/unity-hub.ts index 94d4563..9757f51 100644 --- a/src/unity-hub.ts +++ b/src/unity-hub.ts @@ -1271,10 +1271,10 @@ done return path.join(process.env.APPDATA || '', 'UnityHub', 'logs', 'info-log.json'); case 'darwin': // ~/Library/Application Support/UnityHub/logs/info-log.json - return path.join(os.homedir(), 'Library', 'Application Support', 'UnityHub', 'logs', 'info-log.json'); + return path.join(process.env.HOME || '', 'Library', 'Application Support', 'UnityHub', 'logs', 'info-log.json'); case 'linux': // ~/.config/UnityHub/logs/info-log.json - return path.join(os.homedir(), '.config', 'UnityHub', 'logs', 'info-log.json'); + return path.join(process.env.HOME || '', '.config', 'UnityHub', 'logs', 'info-log.json'); default: throw new Error(`Unsupported platform: ${process.platform}`); } From 21998cce9d5ac5607aae98c245dff5b880cea107 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 13:17:58 -0500 Subject: [PATCH 07/19] try looking in alt path --- .github/workflows/build-options.json | 4 ---- .github/workflows/unity-build.yml | 6 ++++++ src/license-client.ts | 8 ++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-options.json b/.github/workflows/build-options.json index b167129..b9b9f77 100644 --- a/.github/workflows/build-options.json +++ b/.github/workflows/build-options.json @@ -5,10 +5,6 @@ "macos-latest" ], "unity-version": [ - "4.7.2", - "5.6.7f1 (e80cc3114ac1)", - "2017.4.40f1", - "2018", "2019.x", "2020.*", "2021.3.x", diff --git a/.github/workflows/unity-build.yml b/.github/workflows/unity-build.yml index a697286..e85d977 100644 --- a/.github/workflows/unity-build.yml +++ b/.github/workflows/unity-build.yml @@ -98,6 +98,12 @@ jobs: fi if [ ! -f "${HUB_LOG_PATH}" ]; then echo "Error: Hub log file does not exist at ${HUB_LOG_PATH}" + # try looking in UNITY_HUB_PATH/Logs/ + ALT_HUB_LOG_PATH="${UNITY_HUB_PATH}/Logs/UnityHub.log" + if [ -f "${ALT_HUB_LOG_PATH}" ]; then + echo "::warning::Found Hub log file at alternative location: ${ALT_HUB_LOG_PATH}" + exit 0 + fi exit 1 fi - name: Create Unity Project diff --git a/src/license-client.ts b/src/license-client.ts index f5a5cc8..ea618e0 100644 --- a/src/license-client.ts +++ b/src/license-client.ts @@ -131,10 +131,10 @@ export class LicensingClient { return path.join(process.env.LOCALAPPDATA || '', 'Unity', 'Unity.Licensing.Client.log'); case 'darwin': // ~/Library/Logs/Unity/Unity.Licensing.Client.log - return path.join(os.homedir(), 'Library', 'Logs', 'Unity', 'Unity.Licensing.Client.log'); + return path.join(process.env.HOME || '', 'Library', 'Logs', 'Unity', 'Unity.Licensing.Client.log'); case 'linux': // ~/.config/unity3d/Unity/Unity.Licensing.Client.log - return path.join(os.homedir(), '.config', 'unity3d', 'Unity', 'Unity.Licensing.Client.log'); + return path.join(process.env.HOME || '', '.config', 'unity3d', 'Unity', 'Unity.Licensing.Client.log'); default: throw new Error(`Unsupported platform: ${process.platform}`); } @@ -152,10 +152,10 @@ export class LicensingClient { return path.join(process.env.LOCALAPPDATA || '', 'Unity', 'Unity.Entitlements.Audit.log'); case 'darwin': // ~/Library/Logs/Unity/Unity.Entitlements.Audit.log - return path.join(os.homedir(), 'Library', 'Logs', 'Unity', 'Unity.Entitlements.Audit.log'); + return path.join(process.env.HOME || '', 'Library', 'Logs', 'Unity', 'Unity.Entitlements.Audit.log'); case 'linux': // ~/.config/unity3d/Unity/Unity.Entitlements.Audit.log - return path.join(os.homedir(), '.config', 'unity3d', 'Unity', 'Unity.Entitlements.Audit.log'); + return path.join(process.env.HOME || '', '.config', 'unity3d', 'Unity', 'Unity.Entitlements.Audit.log'); default: throw new Error(`Unsupported platform: ${process.platform}`); } From affefb931c5ffaf50818cb930050555c955edd11 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 13:20:11 -0500 Subject: [PATCH 08/19] more alts --- .github/workflows/unity-build.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/unity-build.yml b/.github/workflows/unity-build.yml index e85d977..9d81aee 100644 --- a/.github/workflows/unity-build.yml +++ b/.github/workflows/unity-build.yml @@ -103,6 +103,13 @@ jobs: if [ -f "${ALT_HUB_LOG_PATH}" ]; then echo "::warning::Found Hub log file at alternative location: ${ALT_HUB_LOG_PATH}" exit 0 + else + # try ~/.config/UnityHub/logs/UnityHub.log + ALT_HUB_LOG_PATH="${HOME}/.config/UnityHub/logs/UnityHub.log" + if [ -f "${ALT_HUB_LOG_PATH}" ]; then + echo "::warning::Found Hub log file at alternative location: ${ALT_HUB_LOG_PATH}" + exit 0 + fi fi exit 1 fi From 4187203f5c5c8a29c86bf8dd3b9abd47d43186e1 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 13:21:04 -0500 Subject: [PATCH 09/19] logs --- .github/workflows/unity-build.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unity-build.yml b/.github/workflows/unity-build.yml index 9d81aee..63e048d 100644 --- a/.github/workflows/unity-build.yml +++ b/.github/workflows/unity-build.yml @@ -92,20 +92,26 @@ jobs: echo "Error: Licensing Client log file does not exist at ${LICENSING_CLIENT_LOG_PATH}" exit 1 fi + if [ ! -f "${LICENSING_AUDIT_LOG_PATH}" ]; then echo "Error: Licensing Audit log file does not exist at ${LICENSING_AUDIT_LOG_PATH}" exit 1 fi + if [ ! -f "${HUB_LOG_PATH}" ]; then - echo "Error: Hub log file does not exist at ${HUB_LOG_PATH}" - # try looking in UNITY_HUB_PATH/Logs/ + echo "::warning:: Hub log file does not exist at ${HUB_LOG_PATH}" + ALT_HUB_LOG_PATH="${UNITY_HUB_PATH}/Logs/UnityHub.log" + echo "Checking alternative Hub log path: ${ALT_HUB_LOG_PATH}" + if [ -f "${ALT_HUB_LOG_PATH}" ]; then echo "::warning::Found Hub log file at alternative location: ${ALT_HUB_LOG_PATH}" exit 0 else # try ~/.config/UnityHub/logs/UnityHub.log ALT_HUB_LOG_PATH="${HOME}/.config/UnityHub/logs/UnityHub.log" + echo "Checking alternative Hub log path: ${ALT_HUB_LOG_PATH}" + if [ -f "${ALT_HUB_LOG_PATH}" ]; then echo "::warning::Found Hub log file at alternative location: ${ALT_HUB_LOG_PATH}" exit 0 From f22328890606164197eca21fb6b4d03d021a52f3 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 13:31:58 -0500 Subject: [PATCH 10/19] try with ~ --- .github/workflows/unity-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unity-build.yml b/.github/workflows/unity-build.yml index 63e048d..4a461ea 100644 --- a/.github/workflows/unity-build.yml +++ b/.github/workflows/unity-build.yml @@ -109,7 +109,7 @@ jobs: exit 0 else # try ~/.config/UnityHub/logs/UnityHub.log - ALT_HUB_LOG_PATH="${HOME}/.config/UnityHub/logs/UnityHub.log" + ALT_HUB_LOG_PATH="~/.config/UnityHub/logs/UnityHub.log" echo "Checking alternative Hub log path: ${ALT_HUB_LOG_PATH}" if [ -f "${ALT_HUB_LOG_PATH}" ]; then From 83d00e427c03e391f860c59ac2dd102e8c6d2080 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 13:34:49 -0500 Subject: [PATCH 11/19] search --- .github/workflows/unity-build.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/unity-build.yml b/.github/workflows/unity-build.yml index 4a461ea..f9312e1 100644 --- a/.github/workflows/unity-build.yml +++ b/.github/workflows/unity-build.yml @@ -117,6 +117,20 @@ jobs: exit 0 fi fi + + echo "::error:: Hub log file does not exist at any known location" + + # search the whole disk for *.UnityHub.log files and print their paths + echo "Searching for UnityHub.log files on the system:" + paths=$(find / -type f -name "*.UnityHub.log" 2>/dev/null) + if [ -z "$paths" ]; then + echo "No UnityHub.log files found on the system." + else + echo "Found UnityHub.log files at the following locations:" + for path in $paths; do + echo "$path" + done + fi exit 1 fi - name: Create Unity Project From 5889e69d0bcb1909e9fc265532cbecc2dfe28f60 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 13:59:32 -0500 Subject: [PATCH 12/19] add package manager logs path --- .github/workflows/unity-build.yml | 37 +++++++++++++++---------------- README.md | 9 ++++++++ src/cli.ts | 7 ++++++ src/unity-editor.ts | 4 ++-- src/unity-hub.ts | 21 ++++++++++++++++++ 5 files changed, 57 insertions(+), 21 deletions(-) diff --git a/.github/workflows/unity-build.yml b/.github/workflows/unity-build.yml index f9312e1..103bc46 100644 --- a/.github/workflows/unity-build.yml +++ b/.github/workflows/unity-build.yml @@ -61,12 +61,12 @@ jobs: echo "UNITY_PROJECT_PATH: ${UNITY_PROJECT_PATH}" # Expected to be empty at this point if [ -z "${UNITY_HUB_PATH}" ]; then - echo "Error: UNITY_HUB_PATH is not set" + echo "::error::UNITY_HUB_PATH is not set" exit 1 fi if [ "${{ matrix.unity-version }}" != "none" ] && [ -z "${UNITY_EDITOR_PATH}" ]; then - echo "Error: UNITY_EDITOR_PATH is not set" + echo "::error::UNITY_EDITOR_PATH is not set" exit 1 fi - name: Activate License @@ -80,28 +80,35 @@ jobs: shell: bash run: | HUB_LOG_PATH=$(unity-cli hub-logs) + PACKAGE_MANAGER_LOG_PATH=$(unity-cli package-manager-logs) LICENSING_CLIENT_LOG_PATH=$(unity-cli licensing-client-logs) LICENSING_AUDIT_LOG_PATH=$(unity-cli licensing-audit-logs) echo "Hub Log Path: ${HUB_LOG_PATH}" + echo "Package Manager Log Path: ${PACKAGE_MANAGER_LOG_PATH}" echo "Licensing Client Log Path: ${LICENSING_CLIENT_LOG_PATH}" echo "Licensing Audit Log Path: ${LICENSING_AUDIT_LOG_PATH}" # verify that the log files exist if [ ! -f "${LICENSING_CLIENT_LOG_PATH}" ]; then - echo "Error: Licensing Client log file does not exist at ${LICENSING_CLIENT_LOG_PATH}" + echo "::error::Licensing Client log file does not exist at ${LICENSING_CLIENT_LOG_PATH}" + exit 1 + fi + + if [ ! -f "${PACKAGE_MANAGER_LOG_PATH}" ]; then + echo "::error::Package Manager log file does not exist at ${PACKAGE_MANAGER_LOG_PATH}" exit 1 fi if [ ! -f "${LICENSING_AUDIT_LOG_PATH}" ]; then - echo "Error: Licensing Audit log file does not exist at ${LICENSING_AUDIT_LOG_PATH}" + echo "::error::Licensing Audit log file does not exist at ${LICENSING_AUDIT_LOG_PATH}" exit 1 fi if [ ! -f "${HUB_LOG_PATH}" ]; then echo "::warning:: Hub log file does not exist at ${HUB_LOG_PATH}" - ALT_HUB_LOG_PATH="${UNITY_HUB_PATH}/Logs/UnityHub.log" + ALT_HUB_LOG_PATH="${UNITY_HUB_PATH}/logs/info-log.json" echo "Checking alternative Hub log path: ${ALT_HUB_LOG_PATH}" if [ -f "${ALT_HUB_LOG_PATH}" ]; then @@ -109,7 +116,7 @@ jobs: exit 0 else # try ~/.config/UnityHub/logs/UnityHub.log - ALT_HUB_LOG_PATH="~/.config/UnityHub/logs/UnityHub.log" + ALT_HUB_LOG_PATH="~/.config/UnityHub/logs/info-log.json" echo "Checking alternative Hub log path: ${ALT_HUB_LOG_PATH}" if [ -f "${ALT_HUB_LOG_PATH}" ]; then @@ -118,19 +125,11 @@ jobs: fi fi - echo "::error:: Hub log file does not exist at any known location" + # list all .log and .json files in ~/.config/UnityHub/ directory + echo "Listing all .log and .json files in ~/.config/UnityHub/ directory:" + ls -l ~/.config/UnityHub/*.log ~/.config/UnityHub/*.json || true - # search the whole disk for *.UnityHub.log files and print their paths - echo "Searching for UnityHub.log files on the system:" - paths=$(find / -type f -name "*.UnityHub.log" 2>/dev/null) - if [ -z "$paths" ]; then - echo "No UnityHub.log files found on the system." - else - echo "Found UnityHub.log files at the following locations:" - for path in $paths; do - echo "$path" - done - fi + echo "::error:: Hub log file does not exist at any known location" exit 1 fi - name: Create Unity Project @@ -144,7 +143,7 @@ jobs: shell: bash run: | if [ -z "${UNITY_PROJECT_PATH}" ]; then - echo "Error: UNITY_PROJECT_PATH is not set" + echo "::error::UNITY_PROJECT_PATH is not set" exit 1 fi # check if the project can be built. Only Unity 2019.4+ and newer majors support the build pipeline package diff --git a/README.md b/README.md index 8255cf7..6abf2b9 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ A powerful command line utility for the Unity Game Engine. Automate Unity projec - [Hub Version](#hub-version) - [Hub Path](#hub-path) - [Hub Logs](#hub-logs) + - [Package Manager Logs](#package-manager-logs) - [Unity Hub Install](#unity-hub-install) - [Run Unity Hub Commands](#run-unity-hub-commands) - [Setup Unity Editor](#setup-unity-editor) @@ -165,6 +166,14 @@ unity-cli hub-path unity-cli hub-logs ``` +##### Package Manager Logs + +`package-manager-logs`: Prints the path to the Unity Package Manager log file. + +```bash +unity-cli package-manager-logs +``` + ##### Unity Hub Install `hub-install [options]`: Install or update the Unity Hub diff --git a/src/cli.ts b/src/cli.ts index e26d614..de477eb 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -202,6 +202,13 @@ program.command('hub-logs') process.exit(0); }); +program.command('package-manager-logs') + .description('Prints the path to the Unity Package Manager log file.') + .action(async () => { + process.stdout.write(`${UnityHub.PackageManagerLogsPath()}\n`); + process.exit(0); + }); + program.command('hub-install') .description('Install the Unity Hub.') .option('--verbose', 'Enable verbose logging.') diff --git a/src/unity-editor.ts b/src/unity-editor.ts index e055a31..62d1fd7 100644 --- a/src/unity-editor.ts +++ b/src/unity-editor.ts @@ -452,12 +452,12 @@ export class UnityEditor { */ static GetEditorLogsDirectory() { switch (process.platform) { + case 'win32': + return path.join(process.env.LOCALAPPDATA || '', 'Unity', 'Editor'); 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}`); } diff --git a/src/unity-hub.ts b/src/unity-hub.ts index 9757f51..cae8760 100644 --- a/src/unity-hub.ts +++ b/src/unity-hub.ts @@ -1279,4 +1279,25 @@ done throw new Error(`Unsupported platform: ${process.platform}`); } } + + /** + * Returns the path to the Unity Package Manager log file. + * @see https://docs.unity3d.com/Manual/LogFiles.html + * @returns The Unity Package Manager log file path. + */ + public static PackageManagerLogsPath(): string { + switch (process.platform) { + case 'win32': + // C:\Users\username\AppData\Local\Unity\Editor\upm.log + return path.join(process.env.LOCALAPPDATA || '', 'Unity', 'Editor', 'upm.log'); + case 'darwin': + // ~/Library/Logs/Unity/upm.log + return path.join(process.env.HOME || '', 'Library', 'Logs', 'Unity', 'upm.log'); + case 'linux': + // ~/.config/unity3d/upm.log + return path.join(process.env.HOME || '', '.config', 'unity3d', 'upm.log'); + default: + throw new Error(`Unsupported platform: ${process.platform}`); + } + } } \ No newline at end of file From 255086644c3594f9309309ae11c04dd7913e367a Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 14:09:02 -0500 Subject: [PATCH 13/19] print logs later --- .github/workflows/unity-build.yml | 89 +++++++++++-------------------- 1 file changed, 32 insertions(+), 57 deletions(-) diff --git a/.github/workflows/unity-build.yml b/.github/workflows/unity-build.yml index 103bc46..5adb553 100644 --- a/.github/workflows/unity-build.yml +++ b/.github/workflows/unity-build.yml @@ -75,63 +75,6 @@ jobs: run: | unity-cli license-context unity-cli activate-license --license personal --email "${{ secrets.UNITY_USERNAME }}" --password "${{ secrets.UNITY_PASSWORD }}" - - name: Print log paths - if: ${{ matrix.unity-version != 'none' }} - shell: bash - run: | - HUB_LOG_PATH=$(unity-cli hub-logs) - PACKAGE_MANAGER_LOG_PATH=$(unity-cli package-manager-logs) - LICENSING_CLIENT_LOG_PATH=$(unity-cli licensing-client-logs) - LICENSING_AUDIT_LOG_PATH=$(unity-cli licensing-audit-logs) - - echo "Hub Log Path: ${HUB_LOG_PATH}" - echo "Package Manager Log Path: ${PACKAGE_MANAGER_LOG_PATH}" - echo "Licensing Client Log Path: ${LICENSING_CLIENT_LOG_PATH}" - echo "Licensing Audit Log Path: ${LICENSING_AUDIT_LOG_PATH}" - - # verify that the log files exist - if [ ! -f "${LICENSING_CLIENT_LOG_PATH}" ]; then - echo "::error::Licensing Client log file does not exist at ${LICENSING_CLIENT_LOG_PATH}" - exit 1 - fi - - if [ ! -f "${PACKAGE_MANAGER_LOG_PATH}" ]; then - echo "::error::Package Manager log file does not exist at ${PACKAGE_MANAGER_LOG_PATH}" - exit 1 - fi - - if [ ! -f "${LICENSING_AUDIT_LOG_PATH}" ]; then - echo "::error::Licensing Audit log file does not exist at ${LICENSING_AUDIT_LOG_PATH}" - exit 1 - fi - - if [ ! -f "${HUB_LOG_PATH}" ]; then - echo "::warning:: Hub log file does not exist at ${HUB_LOG_PATH}" - - ALT_HUB_LOG_PATH="${UNITY_HUB_PATH}/logs/info-log.json" - echo "Checking alternative Hub log path: ${ALT_HUB_LOG_PATH}" - - if [ -f "${ALT_HUB_LOG_PATH}" ]; then - echo "::warning::Found Hub log file at alternative location: ${ALT_HUB_LOG_PATH}" - exit 0 - else - # try ~/.config/UnityHub/logs/UnityHub.log - ALT_HUB_LOG_PATH="~/.config/UnityHub/logs/info-log.json" - echo "Checking alternative Hub log path: ${ALT_HUB_LOG_PATH}" - - if [ -f "${ALT_HUB_LOG_PATH}" ]; then - echo "::warning::Found Hub log file at alternative location: ${ALT_HUB_LOG_PATH}" - exit 0 - fi - fi - - # list all .log and .json files in ~/.config/UnityHub/ directory - echo "Listing all .log and .json files in ~/.config/UnityHub/ directory:" - ls -l ~/.config/UnityHub/*.log ~/.config/UnityHub/*.json || true - - echo "::error:: Hub log file does not exist at any known location" - exit 1 - fi - name: Create Unity Project if: ${{ matrix.unity-version != 'none' }} shell: bash @@ -192,6 +135,38 @@ jobs: exit 0 fi unity-cli uninstall-unity --unity-editor "${UNITY_EDITOR_PATH}" + - name: Print log paths + if: ${{ matrix.unity-version != 'none' }} + shell: bash + run: | + HUB_LOG_PATH=$(unity-cli hub-logs) + PACKAGE_MANAGER_LOG_PATH=$(unity-cli package-manager-logs) + LICENSING_CLIENT_LOG_PATH=$(unity-cli licensing-client-logs) + LICENSING_AUDIT_LOG_PATH=$(unity-cli licensing-audit-logs) + + echo "Hub Log Path: ${HUB_LOG_PATH}" + echo "Package Manager Log Path: ${PACKAGE_MANAGER_LOG_PATH}" + echo "Licensing Client Log Path: ${LICENSING_CLIENT_LOG_PATH}" + echo "Licensing Audit Log Path: ${LICENSING_AUDIT_LOG_PATH}" + + if [ ! -f "${HUB_LOG_PATH}" ]; then + echo "::warning:: Hub log file does not exist at ${HUB_LOG_PATH}" + find all .log and .json files in ~/.config/unity3d/ - print their paths + find ~/.config/unity3d/ -type f \( -name "*.log" -o -name "*.json" \) -exec echo "Found log/json file: {}" \; + echo "::error:: Hub log file does not exist at any known location" + fi + + if [ ! -f "${PACKAGE_MANAGER_LOG_PATH}" ]; then + echo "::error::Package Manager log file does not exist at ${PACKAGE_MANAGER_LOG_PATH}" + fi + + if [ ! -f "${LICENSING_CLIENT_LOG_PATH}" ]; then + echo "::error::Licensing Client log file does not exist at ${LICENSING_CLIENT_LOG_PATH}" + fi + + if [ ! -f "${LICENSING_AUDIT_LOG_PATH}" ]; then + echo "::error::Licensing Audit log file does not exist at ${LICENSING_AUDIT_LOG_PATH}" + fi - name: Return License if: always() shell: bash From 25a7ef2a29123298d340a0d19559eb7f970a56f8 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 14:19:32 -0500 Subject: [PATCH 14/19] comment --- .github/workflows/unity-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unity-build.yml b/.github/workflows/unity-build.yml index 5adb553..9c5dda6 100644 --- a/.github/workflows/unity-build.yml +++ b/.github/workflows/unity-build.yml @@ -151,7 +151,7 @@ jobs: if [ ! -f "${HUB_LOG_PATH}" ]; then echo "::warning:: Hub log file does not exist at ${HUB_LOG_PATH}" - find all .log and .json files in ~/.config/unity3d/ - print their paths + # find all .log and .json files in ~/.config/unity3d/ - print their paths find ~/.config/unity3d/ -type f \( -name "*.log" -o -name "*.json" \) -exec echo "Found log/json file: {}" \; echo "::error:: Hub log file does not exist at any known location" fi From 3e5daf9611a530cb95eac7fcba47d4bdcfbbaa36 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 14:22:16 -0500 Subject: [PATCH 15/19] also try in hub path parent directory --- .github/workflows/unity-build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/unity-build.yml b/.github/workflows/unity-build.yml index 9c5dda6..f582b8e 100644 --- a/.github/workflows/unity-build.yml +++ b/.github/workflows/unity-build.yml @@ -153,6 +153,11 @@ jobs: echo "::warning:: Hub log file does not exist at ${HUB_LOG_PATH}" # find all .log and .json files in ~/.config/unity3d/ - print their paths find ~/.config/unity3d/ -type f \( -name "*.log" -o -name "*.json" \) -exec echo "Found log/json file: {}" \; + # also try to find in UNITY_HUB_PATH parent directory if set + if [ -n "${UNITY_HUB_PATH}" ]; then + HUB_DIR=$(dirname "${UNITY_HUB_PATH}") + find "${HUB_DIR}" -type f \( -name "*.log" -o -name "*.json" \) -exec echo "Found log/json file in HUB_DIR: {}" \; + fi echo "::error:: Hub log file does not exist at any known location" fi From 7251376b89d0a48e9ef3db4b0f389f642158223f Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 14:38:39 -0500 Subject: [PATCH 16/19] limit search scope --- .github/workflows/unity-build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unity-build.yml b/.github/workflows/unity-build.yml index f582b8e..5ca0a04 100644 --- a/.github/workflows/unity-build.yml +++ b/.github/workflows/unity-build.yml @@ -151,12 +151,12 @@ jobs: if [ ! -f "${HUB_LOG_PATH}" ]; then echo "::warning:: Hub log file does not exist at ${HUB_LOG_PATH}" - # find all .log and .json files in ~/.config/unity3d/ - print their paths - find ~/.config/unity3d/ -type f \( -name "*.log" -o -name "*.json" \) -exec echo "Found log/json file: {}" \; + # find all info-log.json files in ~/.config/unity3d/ - print their paths + find ~/.config/unity3d/ -type f \( -name "info-log.json" \) -exec echo "{}" \; # also try to find in UNITY_HUB_PATH parent directory if set if [ -n "${UNITY_HUB_PATH}" ]; then HUB_DIR=$(dirname "${UNITY_HUB_PATH}") - find "${HUB_DIR}" -type f \( -name "*.log" -o -name "*.json" \) -exec echo "Found log/json file in HUB_DIR: {}" \; + find "${HUB_DIR}" -type f \( -name "info-log.json" \) -exec echo "{}" \; fi echo "::error:: Hub log file does not exist at any known location" fi From 994ecf9491546683887897043a1c920f9dce8b83 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 14:48:45 -0500 Subject: [PATCH 17/19] echo echo echo --- .github/workflows/unity-build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/unity-build.yml b/.github/workflows/unity-build.yml index 5ca0a04..111ecfb 100644 --- a/.github/workflows/unity-build.yml +++ b/.github/workflows/unity-build.yml @@ -158,6 +158,8 @@ jobs: HUB_DIR=$(dirname "${UNITY_HUB_PATH}") find "${HUB_DIR}" -type f \( -name "info-log.json" \) -exec echo "{}" \; fi + # print all files found in ~/.config/UnityHub/logs/ + find ~/.config/UnityHub/logs/ -type f -exec echo "{}" \; echo "::error:: Hub log file does not exist at any known location" fi From ccc3ab818db4fa1c61b0c01e79537d06f6e13682 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 14:59:49 -0500 Subject: [PATCH 18/19] one level up --- .github/workflows/unity-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unity-build.yml b/.github/workflows/unity-build.yml index 111ecfb..f393574 100644 --- a/.github/workflows/unity-build.yml +++ b/.github/workflows/unity-build.yml @@ -158,8 +158,8 @@ jobs: HUB_DIR=$(dirname "${UNITY_HUB_PATH}") find "${HUB_DIR}" -type f \( -name "info-log.json" \) -exec echo "{}" \; fi - # print all files found in ~/.config/UnityHub/logs/ - find ~/.config/UnityHub/logs/ -type f -exec echo "{}" \; + # print all files found in ~/.config/UnityHub/ + find ~/.config/UnityHub/ -type f -exec echo "{}" \; echo "::error:: Hub log file does not exist at any known location" fi From 73a586733a519a017216910951147f6f7be0fe43 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 27 Nov 2025 15:24:17 -0500 Subject: [PATCH 19/19] scope down --- .github/workflows/unity-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unity-build.yml b/.github/workflows/unity-build.yml index f393574..881acaa 100644 --- a/.github/workflows/unity-build.yml +++ b/.github/workflows/unity-build.yml @@ -158,8 +158,8 @@ jobs: HUB_DIR=$(dirname "${UNITY_HUB_PATH}") find "${HUB_DIR}" -type f \( -name "info-log.json" \) -exec echo "{}" \; fi - # print all files found in ~/.config/UnityHub/ - find ~/.config/UnityHub/ -type f -exec echo "{}" \; + # print all files found in ~/.config/ + find ~/.config/ -type f -exec echo "{}" \; echo "::error:: Hub log file does not exist at any known location" fi