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

[11.x.x] Fix issue causing materials to upgrade multiple times #2510

Merged
merged 3 commits into from
Nov 5, 2020

Conversation

pbbastian
Copy link
Contributor

Purpose of this PR

Fix case 1287931 where materials were getting their _BaseColor upgraded to (1, 1, 1, 1). The reason is that the material upgrader was broken previously, and would soft-crash when it hit a material with a sub-object where the script is missing. In the repro project, this was the HDRP material version. That in turn caused all materials from that point on to not get a URP material version assigned. That was fixed some time ago, and so the upgrader now thinks those materials are at version 0, causing it to apply all upgrades to it, even though it was actually much newer than that. So we have a bunch of materials in the wild with missing version numbers. There is no accurate way of knowing their version.

In this PR, I change the default to be the current project version instead of version 0. This is a guess, but I think it's a very reasonable guess. The only case it does not work in is if you're adding a material to your project that wrongly does not have a version, where the "true" version does not match the project material version. Otherwise, since the material is in your project it will have been used with the current project material version. It does mean that version 0 materials will no longer upgrade correctly, and thus require manual fix-up. Version 0 is from before LWRP went out of preview, and thus we think this is an acceptable loss.

Either way, this is a conservative approach that is making us upgrade less rather than more. Stuff that wasn't upgraded enough can be manually fixed, while upgrading too much could cause user data to be overwritten.

Material files with missing versions can still be manually touched up by copying the version YAML into the file, and setting it to the appropriate version. If it's a major issue for many people, we have the option of automating this from a contextual menu, but for now it is more important to land this fix ASAP.

I also introduce a new material version that doesn't actually do anything property-wise, but forces all materials in the project to get an asset version.


Testing status

Verified the fix locally using the repro steps from fogbugz.

@pbbastian pbbastian requested a review from phi-lira November 3, 2020 15:00
@pbbastian pbbastian requested a review from a team as a code owner November 3, 2020 15:00
@pbbastian pbbastian changed the title Fix issue causing materials to upgrade multiple times [11.x.x] Fix issue causing materials to upgrade multiple times Nov 3, 2020
@pbbastian pbbastian requested a review from a team November 3, 2020 15:40
@erikabar erikabar requested review from erikabar and removed request for a team November 4, 2020 09:47
Copy link

@erikabar erikabar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified case 1287931, also tested UniversalRenderingExamples project. No issues found.

@phi-lira
Copy link
Contributor

phi-lira commented Nov 5, 2020

Merging. Backport PR is passing on 2020.2, failures are known issues in master branch.

@phi-lira phi-lira merged commit d021545 into master Nov 5, 2020
@phi-lira phi-lira deleted the universal/case-1287931-material-upgraders branch November 5, 2020 10:09
@pbbastian pbbastian mentioned this pull request Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants