diff --git a/action.yml b/action.yml index 0ade5fcb..7f58660e 100644 --- a/action.yml +++ b/action.yml @@ -35,6 +35,10 @@ inputs: required: false default: '' description: 'Suppresses `-quit`. Exit your build method using `EditorApplication.Exit(0)` instead.' + enableGpu: + required: false + default: '' + description: 'Launches unity without specifying `-nographics`.' customParameters: required: false default: '' diff --git a/dist/index.js b/dist/index.js index 298a0486..37cb10c7 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 b5bf2a4d..20a881ef 100644 Binary files a/dist/index.js.map and b/dist/index.js.map differ diff --git a/dist/platforms/mac/steps/build.sh b/dist/platforms/mac/steps/build.sh index 8124cf20..b4ef8939 100755 --- a/dist/platforms/mac/steps/build.sh +++ b/dist/platforms/mac/steps/build.sh @@ -131,7 +131,7 @@ echo "" -logFile - \ $( [ "${MANUAL_EXIT}" == "true" ] || echo "-quit" ) \ -batchmode \ - -nographics \ + $( [ "${ENABLE_GPU}" == "true" ] || echo "-nographics" ) \ -username "$UNITY_EMAIL" \ -password "$UNITY_PASSWORD" \ -customBuildName "$BUILD_NAME" \ diff --git a/src/model/build-parameters.ts b/src/model/build-parameters.ts index 42c05915..8cf60d59 100644 --- a/src/model/build-parameters.ts +++ b/src/model/build-parameters.ts @@ -32,6 +32,7 @@ class BuildParameters { public buildMethod!: string; public buildVersion!: string; public manualExit!: boolean; + public enableGpu!: boolean; public androidVersionCode!: string; public androidKeystoreName!: string; public androidKeystoreBase64!: string; @@ -157,6 +158,7 @@ class BuildParameters { buildMethod: Input.buildMethod, buildVersion, manualExit: Input.manualExit, + enableGpu: Input.enableGpu, androidVersionCode, androidKeystoreName: Input.androidKeystoreName, androidKeystoreBase64: Input.androidKeystoreBase64, diff --git a/src/model/image-environment-factory.ts b/src/model/image-environment-factory.ts index fe16ca9d..347d6944 100644 --- a/src/model/image-environment-factory.ts +++ b/src/model/image-environment-factory.ts @@ -42,6 +42,7 @@ class ImageEnvironmentFactory { { name: 'BUILD_FILE', value: parameters.buildFile }, { name: 'BUILD_METHOD', value: parameters.buildMethod }, { name: 'MANUAL_EXIT', value: parameters.manualExit }, + { name: 'ENABLE_GPU', value: parameters.enableGpu }, { name: 'VERSION', value: parameters.buildVersion }, { name: 'ANDROID_VERSION_CODE', value: parameters.androidVersionCode }, { name: 'ANDROID_KEYSTORE_NAME', value: parameters.androidKeystoreName }, diff --git a/src/model/input.test.ts b/src/model/input.test.ts index 6a24264d..ae284547 100644 --- a/src/model/input.test.ts +++ b/src/model/input.test.ts @@ -122,6 +122,24 @@ describe('Input', () => { }); }); + describe('enableGpu', () => { + it('returns the default value', () => { + expect(Input.enableGpu).toStrictEqual(false); + }); + + it('returns true when string true is passed', () => { + const spy = jest.spyOn(core, 'getInput').mockReturnValue('true'); + expect(Input.enableGpu).toStrictEqual(true); + expect(spy).toHaveBeenCalledTimes(1); + }); + + it('returns false when string false is passed', () => { + const spy = jest.spyOn(core, 'getInput').mockReturnValue('false'); + expect(Input.enableGpu).toStrictEqual(false); + expect(spy).toHaveBeenCalledTimes(1); + }); + }); + describe('versioningStrategy', () => { it('returns the default value', () => { expect(Input.versioningStrategy).toStrictEqual('Semantic'); diff --git a/src/model/input.ts b/src/model/input.ts index 7d772a22..0e988884 100644 --- a/src/model/input.ts +++ b/src/model/input.ts @@ -133,6 +133,12 @@ class Input { return input === 'true'; } + static get enableGpu(): boolean { + const input = Input.getInput('enableGpu') ?? false; + + return input === 'true'; + } + static get customParameters(): string { return Input.getInput('customParameters') ?? ''; } diff --git a/src/model/platform-setup/setup-mac.ts b/src/model/platform-setup/setup-mac.ts index fbc5a544..4566e163 100644 --- a/src/model/platform-setup/setup-mac.ts +++ b/src/model/platform-setup/setup-mac.ts @@ -189,6 +189,7 @@ class SetupMac { process.env.CUSTOM_PARAMETERS = buildParameters.customParameters; process.env.CHOWN_FILES_TO = buildParameters.chownFilesTo; process.env.MANUAL_EXIT = buildParameters.manualExit.toString(); + process.env.ENABLE_GPU = buildParameters.enableGpu.toString(); } }