@@ -212,10 +212,6 @@ export class UnityEditor {
212212 throw Error ( 'No command arguments provided for Unity execution' ) ;
213213 }
214214
215- if ( ! command . args . includes ( '-logFile' ) ) {
216- command . args . unshift ( '-logFile' , this . GenerateLogFilePath ( command . projectPath ) ) ;
217- }
218-
219215 if ( this . autoAddNoGraphics &&
220216 ! command . args . includes ( `-nographics` ) &&
221217 ! command . args . includes ( `-force-graphics` ) ) {
@@ -230,6 +226,14 @@ export class UnityEditor {
230226 command . args . unshift ( `-automated` ) ;
231227 }
232228
229+ if ( ! command . args . includes ( '-logFile' ) ) {
230+ command . args . unshift ( '-logFile' , this . GenerateLogFilePath ( command . projectPath ) ) ;
231+ } else {
232+ const existingLogPath = GetArgumentValueAsString ( '-logFile' , command . args ) ;
233+ command . args . splice ( command . args . indexOf ( existingLogPath ) - 1 , 2 ) ;
234+ command . args . unshift ( '-logFile' , existingLogPath ) ;
235+ }
236+
233237 if ( command . projectPath ) {
234238 if ( ! command . args . includes ( '-projectPath' ) ) {
235239 command . args . unshift ( '-projectPath' , command . projectPath ) ;
@@ -241,7 +245,7 @@ export class UnityEditor {
241245 }
242246
243247 // Ensure -projectPath is the first argument
244- command . args . splice ( command . args . indexOf ( existingPath ) , 1 ) ;
248+ command . args . splice ( command . args . indexOf ( existingPath ) - 1 , 2 ) ;
245249 command . args . unshift ( '-projectPath' , command . projectPath ) ;
246250 }
247251 }
0 commit comments