@@ -402,7 +402,7 @@ chmod -R 777 "$hubPath"`]);
402402 * @param modules The modules to install alongside the editor.
403403 * @returns The path to the Unity Editor executable.
404404 */
405- public async GetEditor ( unityVersion : UnityVersion , modules : string [ ] ) : Promise < string > {
405+ public async GetEditor ( unityVersion : UnityVersion , modules : string [ ] ) : Promise < UnityEditor > {
406406 const retryErrorMessages = [
407407 'Editor already installed in this location' ,
408408 'failed to download. Error given: Request timeout'
@@ -442,6 +442,7 @@ chmod -R 777 "$hubPath"`]);
442442 if ( installPath ) {
443443 await DeleteDirectory ( installPath ) ;
444444 }
445+
445446 installPath = await this . installUnity ( unityVersion , modules ) ;
446447 } else {
447448 throw error ;
@@ -459,7 +460,7 @@ chmod -R 777 "$hubPath"`]);
459460 await this . patchBeeBackend ( editorPath ) ;
460461
461462 if ( unityVersion . isLegacy ( ) || modules . length === 0 ) {
462- return editorPath ;
463+ return new UnityEditor ( path . normalize ( editorPath ) , unityVersion ) ;
463464 }
464465
465466 try {
@@ -487,7 +488,7 @@ chmod -R 777 "$hubPath"`]);
487488 }
488489 }
489490
490- return path . normalize ( editorPath ) ;
491+ return new UnityEditor ( path . normalize ( editorPath ) , unityVersion ) ;
491492 }
492493
493494 /**
@@ -503,6 +504,7 @@ chmod -R 777 "$hubPath"`]);
503504
504505 private async checkInstalledEditors ( unityVersion : UnityVersion , failOnEmpty : boolean , installPath : string | undefined = undefined ) : Promise < string | undefined > {
505506 let editorPath = undefined ;
507+
506508 if ( ! installPath ) {
507509 const paths : string [ ] = await this . ListInstalledEditors ( ) ;
508510
@@ -578,7 +580,7 @@ chmod -R 777 "$hubPath"`]);
578580 throw new Error ( `Failed to find installed Unity Editor: ${ unityVersion . toString ( ) } \n > ${ error } ` ) ;
579581 }
580582
581- this . logger . ci ( `Found installed Unity Editor: ${ editorPath } ` ) ;
583+ this . logger . debug ( `Found installed editor: " ${ editorPath } " ` ) ;
582584 return editorPath ;
583585 }
584586
799801 }
800802
801803 private async installUnity ( unityVersion : UnityVersion , modules : string [ ] ) : Promise < string | undefined > {
804+ this . logger . ci ( `Installing Unity ${ unityVersion . toString ( ) } ...` ) ;
805+
802806 if ( unityVersion . isLegacy ( ) ) {
803807 return await this . installUnity4x ( unityVersion ) ;
804808 }
848852 args . push ( '--cm' ) ;
849853 }
850854
851- this . logger . info ( `Installing Unity ${ unityVersion . toString ( ) } ...` ) ;
852855 const output = await this . Exec ( args , { showCommand : true , silent : false } ) ;
853856
854857 if ( output . includes ( `Error while installing an editor or a module from changeset` ) ) {
871874 this . logger . info ( `Running Unity ${ unityVersion . toString ( ) } installer...` ) ;
872875
873876 try {
874- await Exec ( installerPath , [ '/S ' , `/ D=${ installPath } ` , ' -Wait' , ' -NoNewWindow' ] , { silent : true , showCommand : true } ) ;
877+ await Exec ( 'powershell' , [ '-Command ' , `Start-Process -FilePath \" ${ installerPath } \" -ArgumentList \"/S / D=${ installPath } \" -Wait -NoNewWindow` ] , { silent : true , showCommand : true } ) ;
875878 } catch ( error ) {
876879 this . logger . error ( `Failed to install Unity ${ unityVersion . toString ( ) } : ${ error } ` ) ;
877880 } finally {
0 commit comments