Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/unity-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
unity-cli hub-install --auto-update
unity-cli activate-license --license personal --email "${{ secrets.UNITY_USERNAME }}" --password "${{ secrets.UNITY_PASSWORD }}"
setup_output=$(unity-cli setup-unity --unity-version "${{ matrix.unity-version }}" --build-targets "${{ matrix.build-targets }}" --json)
unity_editor_path=$(echo "$setup_output" | tail -n 1 | jq -r '.UNITY_EDITOR')
unity_editor_path=$(echo "$setup_output" | tail -n 1 | jq -r '.UNITY_EDITOR_PATH')
echo "$unity_editor_path"
create_project_output=$(unity-cli create-project --name "Unity Project" --unity-editor "${unity_editor_path}" --json --verbose)
project_path=$(echo "$create_project_output" | tail -n 1 | jq -r '.UNITY_PROJECT_PATH')
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rage-against-the-pixel/unity-cli",
"version": "1.0.5",
"version": "1.0.6",
"description": "A command line utility for the Unity Game Engine.",
"author": "RageAgainstThePixel",
"license": "MIT",
Expand All @@ -13,6 +13,7 @@
},
"homepage": "https://github.com/RageAgainstThePixel/unity-cli#readme",
"keywords": [
"unity-cli",
"unity",
"cli",
"command-line",
Expand Down
14 changes: 7 additions & 7 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ program.command('setup-unity')
const unityEditor = await unityHub.GetEditor(unityVersion, modules);
const output: { [key: string]: string } = {
'UNITY_HUB_PATH': unityHub.executable,
'UNITY_EDITOR': unityEditor.editorPath
'UNITY_EDITOR_PATH': unityEditor.editorPath
};

if (unityProject) {
Expand All @@ -238,7 +238,7 @@ program.command('create-project')
.option('--name <projectName>', 'The name of the new Unity project. If unspecified, the project will be created in the specified path or the current working directory.')
.option('--path <projectPath>', 'The path to create the new Unity project. If unspecified, the current working directory will be used.')
.option('--template <projectTemplate>', 'The name of the template package to use for creating the unity project. Supports regex patterns.', 'com.unity.template.3d(-cross-platform)?')
.option('--unity-editor <unityEditorPath>', 'The path to the Unity Editor executable. If unspecified, the UNITY_EDITOR environment variable must be set.')
.option('--unity-editor <unityEditorPath>', 'The path to the Unity Editor executable. If unspecified, the UNITY_EDITOR_PATH environment variable must be set.')
.option('--verbose', 'Enable verbose logging.')
.option('--json', 'Prints the last line of output as JSON string.')
.action(async (options) => {
Expand All @@ -248,10 +248,10 @@ program.command('create-project')

Logger.instance.debug(JSON.stringify(options));

const editorPath = options.unityEditor?.toString()?.trim() || process.env.UNITY_EDITOR;
const editorPath = options.unityEditor?.toString()?.trim() || process.env.UNITY_EDITOR_PATH;

if (!editorPath || editorPath.length === 0) {
throw new Error('The Unity Editor path was not specified. Use -e or --unity-editor to specify it, or set the UNITY_EDITOR environment variable.');
throw new Error('The Unity Editor path was not specified. Use -e or --unity-editor to specify it, or set the UNITY_EDITOR_PATH environment variable.');
}

const unityEditor = new UnityEditor(editorPath);
Expand Down Expand Up @@ -287,7 +287,7 @@ program.command('create-project')

program.command('run')
.description('Run command line args directly to the Unity Editor.')
.option('--unity-editor <unityEditorPath>', 'The path to the Unity Editor executable. If unspecified, the UNITY_EDITOR environment variable must be set.')
.option('--unity-editor <unityEditorPath>', 'The path to the Unity Editor executable. If unspecified, the UNITY_EDITOR_PATH environment variable must be set.')
.option('--unity-project <unityProjectPath>', 'The path to a Unity project. If unspecified, the UNITY_PROJECT_PATH environment variable or the current working directory will be used.')
.option('--log-name <logName>', 'The name of the log file.')
.allowUnknownOption(true)
Expand All @@ -300,10 +300,10 @@ program.command('run')

Logger.instance.debug(JSON.stringify({ options, args }));

const editorPath = options.unityEditor?.toString()?.trim() || process.env.UNITY_EDITOR;
const editorPath = options.unityEditor?.toString()?.trim() || process.env.UNITY_EDITOR_PATH;

if (!editorPath || editorPath.length === 0) {
throw new Error('The Unity Editor path was not specified. Use -e or --unity-editor to specify it, or set the UNITY_EDITOR environment variable.');
throw new Error('The Unity Editor path was not specified. Use -e or --unity-editor to specify it, or set the UNITY_EDITOR_PATH environment variable.');
}

const unityEditor = new UnityEditor(editorPath);
Expand Down