Skip to content

Fix for unlit materials becoming lit in Unity 2021.x - #120

Merged
Cameron (Cameron-Micka) merged 2 commits into
mainfrom
user/cameron-micka/fix-2021-lighting-keyword
Nov 11, 2022
Merged

Cameron (Cameron-Micka) merged 2 commits into
mainfrom
user/cameron-micka/fix-2021-lighting-keyword

Conversation

@Cameron-Micka

@Cameron-Micka Cameron (Cameron-Micka) commented Nov 11, 2022 •

Copy link
Copy Markdown
Member

Overview

This PR is to fix a regression in #110 that made it so unlit materials when opening in 2021.x+ would become lit until refreshed in the material inspector.

To resolve this the existing _DirectionalLight property is observed as the keyword initializer and materials made in code still are lit correctly.

In summary the fix is to use Unity's toggle rather than enum property drawer to handle initializing the keyword. We have a custom inspector for this field, so nothing changes for the end user.

Changes

  • Fixes: # 110 + new regession

Verification

Note the unlit shader ball in the Material Gallery looks unlit in 2020 and 2021.

As a reviewer, it is possible to check out this change locally by using the following
commands (substituting {PR_ID} with the ID of this pull request):

git fetch origin pull/{PR_ID}/head:name_of_local_branch

git checkout name_of_local_branch

@Cameron-Micka
Cameron (Cameron-Micka) merged commit dbc968c into main Nov 11, 2022
@Cameron-Micka
Cameron (Cameron-Micka) deleted the user/cameron-micka/fix-2021-lighting-keyword branch December 8, 2022 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants