@@ -61395,24 +61395,37 @@ async function main() {
6139561395 throw new Error('UNITY_EDITOR_PATH environment variable must be set!');
6139661396 }
6139761397 const unityEditor = new unity_cli_1.UnityEditor(process.env.UNITY_EDITOR_PATH);
61398- core.debug(`Using Unity Editor at path:\n > ${unityEditor.editorPath}`);
61399- const templatePath = unityEditor.GetTemplatePath(core.getInput('template-name'));
61400- core.debug(`Using Unity template at path:\n > ${templatePath}`);
61398+ core.info(`Using Unity Editor at path:\n > ${unityEditor.editorPath}`);
61399+ let templatePath = undefined;
61400+ if (this.version.isGreaterThan('2018.0.0')) {
61401+ const availableTemplates = unityEditor.GetAvailableTemplates();
61402+ core.startGroup('Available Unity Project Templates:');
61403+ for (const template of availableTemplates) {
61404+ core.info(` - ${template}`);
61405+ }
61406+ core.endGroup();
61407+ templatePath = unityEditor.GetTemplatePath(core.getInput('template-name'));
61408+ core.info(`Using Unity template at path:\n > ${templatePath}`);
61409+ }
61410+ else {
61411+ core.info('Unity Project Templates are not supported for Unity versions below 2018');
61412+ }
6140161413 const projectNameInput = core.getInput('project-name', { required: true });
6140261414 const projectDirectoryInput = core.getInput('project-directory') || process.cwd();
6140361415 const projectPath = `${projectDirectoryInput}/${projectNameInput}`;
61404- core.debug(`Creating Unity project at:\n > ${projectPath}`);
61416+ core.info(`Creating Unity project at:\n > ${projectPath}`);
61417+ const args = [
61418+ '-quit',
61419+ '-nographics',
61420+ '-batchmode',
61421+ '-createProject', projectPath,
61422+ ];
61423+ if (templatePath) {
61424+ args.push('-projectTemplate', templatePath);
61425+ }
6140561426 const logPath = unityEditor.GenerateLogFilePath(projectPath, 'create-unity-project');
61406- await unityEditor.Run({
61407- args: [
61408- '-quit',
61409- '-nographics',
61410- '-batchmode',
61411- '-createProject', projectPath,
61412- '-cloneFromTemplate', templatePath,
61413- '-logFile', logPath
61414- ]
61415- });
61427+ args.push('-logFile', logPath);
61428+ await unityEditor.Run({ args: [...args] });
6141661429 core.setOutput('project-path', projectPath);
6141761430 }
6141861431 catch (error) {
0 commit comments