Unity 에디터에서는 머티리얼 인스펙터에서 머티리얼을 확인할 때 머티리얼의 로컬 셰이더 키워드를 활성화하거나 비활성화할 수 있습니다. 이 기능은 다음 두 가지 이유에서 유용합니다.
[KeywordEnum]
MaterialPropertyDrawer를 사용하여 키워드를 활성화하면, Unity가 세트의 다른 키워드를 자동으로 비활성화합니다. 이를 통해 언제든지 하나의 세트에서 정확히 하나의 키워드만 활성화되도록 보장할 수 있습니다.여느 셰이더 설정 또는 데이터와 마찬가지로, 셰이더 키워드는 셰이더 소스 파일에서 머티리얼 프로퍼티로 선언된 경우에만 머티리얼 인스펙터에서 사용할 수 있습니다.
셰이더 그래프에서 만든 셰이더의 경우, 기본적으로 머티리얼 프로퍼티가 키워드입니다. 즉, 이러한 설정은 머티리얼 인스펙터에서 자동으로 사용할 수 있습니다. 이를 변경하려면 Blackboard를 열고 Exposed 프로퍼티를 변경하십시오.
직접 코딩한 셰이더의 경우, ShaderLab 코드가 키워드 세트를 나타내는 머티리얼 프로퍼티를 정의하도록 보장해야 합니다. 머티리얼 프로퍼티는 Float
타입이 있어야 하며, [Toggle]
, [ToggleOff]
또는 [KeywordEnum]
MaterialPropertyDrawer 속성을 사용해야만 인스펙터에 올바르게 노출될 수 있습니다. 자세한 내용과 예제는 MaterialPropertyDrawer API에 대한 문서를 참조하십시오.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.