@@ -4362,19 +4362,38 @@ class UnityEditor {
43624362 if (!command.args || command.args.length === 0) {
43634363 throw Error('No command arguments provided for Unity execution');
43644364 }
4365- if (!command.args.includes(`-automated`)) {
4366- command.args.push(`-automated`);
4367- }
4368- if (!command.args.includes(`-batchmode`)) {
4369- command.args.push(`-batchmode`);
4370- }
43714365 if (this.autoAddNoGraphics &&
43724366 !command.args.includes(`-nographics`) &&
43734367 !command.args.includes(`-force-graphics`)) {
4374- command.args.push(`-nographics`);
4368+ command.args.unshift(`-nographics`);
4369+ }
4370+ if (!command.args.includes(`-batchmode`)) {
4371+ command.args.unshift(`-batchmode`);
4372+ }
4373+ if (!command.args.includes(`-automated`)) {
4374+ command.args.unshift(`-automated`);
43754375 }
43764376 if (!command.args.includes('-logFile')) {
4377- command.args.push('-logFile', this.GenerateLogFilePath(command.projectPath));
4377+ command.args.unshift('-logFile', this.GenerateLogFilePath(command.projectPath));
4378+ }
4379+ else {
4380+ const existingLogPath = (0, utilities_1.GetArgumentValueAsString)('-logFile', command.args);
4381+ command.args.splice(command.args.indexOf(existingLogPath) - 1, 2);
4382+ command.args.unshift('-logFile', existingLogPath);
4383+ }
4384+ if (command.projectPath) {
4385+ if (!command.args.includes('-projectPath')) {
4386+ command.args.unshift('-projectPath', command.projectPath);
4387+ }
4388+ else {
4389+ const existingPath = (0, utilities_1.GetArgumentValueAsString)('-projectPath', command.args);
4390+ if (existingPath !== command.projectPath) {
4391+ throw Error(`Conflicting project paths provided. Argument: "${existingPath}", Command: "${command.projectPath}"`);
4392+ }
4393+ // Ensure -projectPath is the first argument
4394+ command.args.splice(command.args.indexOf(existingPath) - 1, 2);
4395+ command.args.unshift('-projectPath', command.projectPath);
4396+ }
43784397 }
43794398 const logPath = (0, utilities_1.GetArgumentValueAsString)('-logFile', command.args);
43804399 logTail = (0, utilities_1.TailLogFile)(logPath);
@@ -61423,10 +61442,7 @@ async function main() {
6142361442 const logPath = unityEditor.GenerateLogFilePath(projectPath, 'create-unity-project');
6142461443 const args = [
6142561444 `-logFile`, logPath,
61426- '-automated',
6142761445 '-quit',
61428- '-nographics',
61429- '-batchmode',
6143061446 '-createProject', projectPath,
6143161447 ];
6143261448 if (templatePath) {
0 commit comments