Refactor shader selection in CreateTransparentMaterial#3
Open
JO-Step wants to merge 1 commit into
Open
Conversation
Refactor CreateTransparentMaterial to prioritize shader search and improve error handling.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
部分 Built-in Render Pipeline 游戏为了减小包体,会裁剪 Standard Shader,导致无法创建透明材质,Smart 模式最终会降级为 Disable,导致马赛克材质所在的整个对象被禁用。修改后按顺序尝试更多个常见 Shader,日后也可继续按需添加,只要游戏中存在其中任意一个 Shader,即可正常创建透明材质,提升了不同 Unity 项目的兼容性。
Sprites/Default 与 Standard/URP/HDRP 的材质属性不同,不支持 _Mode、_Surface 等属性。
因此新增针对 Sprites/Default 的处理逻辑,直接创建材质并将颜色 Alpha 设置为 0。避免因属性不存在导致透明材质创建失败。