@@ -36115,7 +36115,8 @@ const retryErrorMessages = [
3611536115];
3611636116async function UnityEditor(unityVersion, modules) {
3611736117 core.info(`Getting release info for Unity ${unityVersion.toString()}...`);
36118- if (!unityVersion.isLegacy()) {
36118+ let editorPath = await checkInstalledEditors(unityVersion, false);
36119+ if (!unityVersion.isLegacy() && !editorPath) {
3611936120 try {
3612036121 const releases = await getLatestHubReleases();
3612136122 unityVersion = unityVersion.findMatch(releases);
@@ -36127,7 +36128,6 @@ async function UnityEditor(unityVersion, modules) {
3612736128 unityVersion = await fallbackVersionLookup(unityVersion);
3612836129 }
3612936130 }
36130- let editorPath = await checkInstalledEditors(unityVersion, false);
3613136131 let installPath = null;
3613236132 if (!editorPath) {
3613336133 try {
@@ -36209,7 +36209,7 @@ async function installUnity(unityVersion, modules) {
3620936209 args.push('--changeset', unityVersion.changeset);
3621036210 }
3621136211 if (unityVersion.architecture) {
36212- args.push('-a', unityVersion.architecture.toLocaleLowerCase ());
36212+ args.push('-a', unityVersion.architecture.toLowerCase ());
3621336213 }
3621436214 if (modules.length > 0) {
3621536215 for (const module of modules) {
@@ -36330,7 +36330,7 @@ async function checkInstalledEditors(unityVersion, failOnEmpty, installPath = un
3633036330async function checkEditorModules(editorPath, unityVersion, modules) {
3633136331 let args = ['install-modules', '--version', unityVersion.version];
3633236332 if (unityVersion.architecture) {
36333- args.push('-a', unityVersion.architecture);
36333+ args.push('-a', unityVersion.architecture.toLowerCase() );
3633436334 }
3633536335 for (const module of modules) {
3633636336 args.push('-m', module);
@@ -36456,31 +36456,48 @@ class UnityVersion {
3645636456 return semver.compare(this.semVer, '2021.0.0', true) >= 0;
3645736457 }
3645836458 findMatch(versions) {
36459- const validReleases = versions
36460- .map(release => semver.coerce(release))
36461- .filter(release => release && semver.satisfies(release, `^${this.semVer}`))
36462- .sort((a, b) => semver.compare(b, a));
36463- core.debug(`Searching for ${this.version}:`);
36464- validReleases.forEach(release => {
36465- core.debug(` > ${release}`);
36459+ const exactMatch = versions.find(r => {
36460+ const match = r.match(/(?<version>\d+\.\d+\.\d+[abcfpx]?\d*)/);
36461+ return match && match.groups && match.groups.version === this.version;
3646636462 });
36467- for (const release of validReleases) {
36468- if (!release) {
36469- continue;
36470- }
36471- const originalRelease = versions.find(r => r.includes(release.version));
36472- if (!originalRelease) {
36473- continue;
36474- }
36475- const match = originalRelease.match(/(?<version>\d+\.\d+\.\d+[abcfpx]?\d*)\s*(?:\((?<arch>Apple silicon|Intel)\))?/);
36476- if (!(match && match.groups && match.groups.version)) {
36477- continue;
36478- }
36479- if ((this.version.includes('a') && match.groups.version.includes('a')) ||
36480- (this.version.includes('b') && match.groups.version.includes('b')) ||
36481- match.groups.version.includes('f')) {
36482- core.debug(`Found Unity ${match.groups.version}`);
36483- return new UnityVersion(match.groups.version, null, this.architecture);
36463+ if (exactMatch) {
36464+ core.debug(`Exact match found for ${this.version}`);
36465+ return new UnityVersion(this.version, null, this.architecture);
36466+ }
36467+ const versionParts = this.version.match(/^(\d+)\.(\d+)\.(\d+)/);
36468+ let minorIsZero = false, patchIsZero = false;
36469+ if (versionParts) {
36470+ const [, , minor, patch] = versionParts;
36471+ minorIsZero = minor === '0';
36472+ patchIsZero = patch === '0';
36473+ }
36474+ if (minorIsZero && patchIsZero) {
36475+ const validReleases = versions
36476+ .map(release => semver.coerce(release))
36477+ .filter(release => release && semver.satisfies(release, `^${this.semVer}`))
36478+ .sort((a, b) => semver.compare(b, a));
36479+ core.debug(`Searching for fallback match for ${this.version}:`);
36480+ validReleases.forEach(release => {
36481+ core.debug(` > ${release}`);
36482+ });
36483+ for (const release of validReleases) {
36484+ if (!release) {
36485+ continue;
36486+ }
36487+ const originalRelease = versions.find(r => r.includes(release.version));
36488+ if (!originalRelease) {
36489+ continue;
36490+ }
36491+ const match = originalRelease.match(/(?<version>\d+\.\d+\.\d+[abcfpx]?\d*)\s*(?:\((?<arch>Apple silicon|Intel)\))?/);
36492+ if (!(match && match.groups && match.groups.version)) {
36493+ continue;
36494+ }
36495+ if ((this.version.includes('a') && match.groups.version.includes('a')) ||
36496+ (this.version.includes('b') && match.groups.version.includes('b')) ||
36497+ match.groups.version.includes('f')) {
36498+ core.debug(`Found fallback Unity ${match.groups.version}`);
36499+ return new UnityVersion(match.groups.version, null, this.architecture);
36500+ }
3648436501 }
3648536502 }
3648636503 core.debug(`No matching Unity version found for ${this.version}`);
0 commit comments