Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log a warning or fail the build on mismatched Unity versions #670

Open
vex-ll opened this issue Sep 27, 2024 · 2 comments
Open

Log a warning or fail the build on mismatched Unity versions #670

vex-ll opened this issue Sep 27, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@vex-ll
Copy link

vex-ll commented Sep 27, 2024

Context

It is possible to set a unityVersion or a customImage from a version that's different from the version in the project being built. This could result in unexpected behavior from the differences of unity version -- in my case, the project was in 2022.3.x and I incorrectly set the a unityVersion (for Mac) and a customImage (for Windows) on Unity 2023.2.x, resulting in fonts rendering incorrectly or not at all.

Suggested solution

Whenever the unityVersion or customImage is set, the execution should first read the first line of the ProjectSettings/ProjectVersion.txt file to validate that the versions match. If not, the build should either issue a warning or outright fail.

Considered alternatives

Using the auto value for unityVersion is an alternative, but might not be desirable or possible every time, especially if you need a custom image for builds.

Another alternative is the project manually checking from bash the contents of the ProjectVersion.txt file, but it would be of course much nicer if this happens out of the box from unity-builder.

@vex-ll vex-ll added the enhancement New feature or request label Sep 27, 2024
@GabLeRoux
Copy link
Member

Thanks for reporting that! A warning is a great approach to help identify this issue without disrupting the build.

Failing the build is also an option, but since it could be a breaking change, I think a warning would be a better initial choice.

At some point, we could introduce a strict parameter to fail builds on warning. We’d probably need to discuss this a bit more, but I’m sure we can go forward with a warning. 👍 thanks again!

@webbertakken
Copy link
Member

Agree with the warning.

A few more thoughts:

Since under normal circumstances the unityVersion shouldn't be specified at all, as it autodetects the version from the checked out project, I'd say our stance should be that the correct way is to not specify it at all. I think the docs currently reflect this.

For a custom image, you'd expect someone to use the version of their actual project under normal circumstances. But upgrading a project and CI step by step might be a legit use case where you wouldn't want the pipeline to artificially fail.

Therefor I would suggest sticking with the warning for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants