diff --git a/dist/index.js b/dist/index.js index e0b2de85..dc3aac42 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/dist/index.js.map b/dist/index.js.map index 2bdd16ed..6f16cb34 100644 Binary files a/dist/index.js.map and b/dist/index.js.map differ diff --git a/src/model/platform-setup/setup-mac.ts b/src/model/platform-setup/setup-mac.ts index d529d21f..70ce06f8 100644 --- a/src/model/platform-setup/setup-mac.ts +++ b/src/model/platform-setup/setup-mac.ts @@ -47,7 +47,10 @@ class SetupMac { // Ignoring return code because the log seems to overflow the internal buffer which triggers // a false error - const errorCode = await exec(command, undefined, { silent, ignoreReturnCode: true }); + const errorCode = await exec(command, undefined, { + silent, + ignoreReturnCode: true, + }); if (errorCode) { throw new Error(`There was an error installing the Unity Editor. See logs above for details.`); } @@ -64,7 +67,9 @@ class SetupMac { private static async getLatestUnityHubVersion(): Promise { // Need to check if the latest version available is the same as the one we have cached const hubVersionCommand = `/bin/bash -c "brew info unity-hub | grep -o '[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+'"`; - const result = await getExecOutput(hubVersionCommand, undefined, { silent: true }); + const result = await getExecOutput(hubVersionCommand, undefined, { + silent: true, + }); if (result.exitCode === 0 && result.stdout !== '') { return result.stdout; } @@ -72,6 +77,23 @@ class SetupMac { return ''; } + private static getArchitectureParameters(): string[] { + const architectureArgument = []; + + switch (process.arch) { + case 'x64': + architectureArgument.push('--architecture', 'x86_64'); + break; + case 'arm64': + architectureArgument.push('--architecture', 'arm64'); + break; + default: + throw new Error(`Unsupported architecture: ${process.arch}.`); + } + + return architectureArgument; + } + private static getModuleParametersForTargetPlatform(targetPlatform: string): string[] { const moduleArgument = []; switch (targetPlatform) { @@ -111,6 +133,7 @@ class SetupMac { const unityChangeset = await getUnityChangeset(buildParameters.editorVersion); const moduleArguments = SetupMac.getModuleParametersForTargetPlatform(buildParameters.targetPlatform); + const architectureArguments = SetupMac.getArchitectureParameters(); const execArguments: string[] = [ '--', @@ -119,12 +142,16 @@ class SetupMac { ...['--version', buildParameters.editorVersion], ...['--changeset', unityChangeset.changeset], ...moduleArguments, + ...architectureArguments, '--childModules', ]; // Ignoring return code because the log seems to overflow the internal buffer which triggers // a false error - const errorCode = await exec(this.unityHubExecPath, execArguments, { silent, ignoreReturnCode: true }); + const errorCode = await exec(this.unityHubExecPath, execArguments, { + silent, + ignoreReturnCode: true, + }); if (errorCode) { throw new Error(`There was an error installing the Unity Editor. See logs above for details.`); }