머티리얼 프로퍼티에서__ ShaderLab__셰이더 오브젝트의 구조를 정의하기 위한 Unity 언어입니다. 자세한 정보
See in Glossary 코드의 변수 값을 설정하려면 ShaderLab 코드에서 머티리얼 프로퍼티 이름을 대괄호 안에 넣으십시오.
이 예시 코드는 머티리얼 프로퍼티를 사용하여 ShaderLab Offset 커맨드의 units 값을 설정하는 구문을 나타냅니다.
Shader "Examples/MaterialPropertyShaderLab"
{
Properties
{
// Change this value in the Material Inspector to affect the value of the Offset command
_OffsetUnitScale ("Offset unit scale", Integer) = 1
}
SubShader
{
// The code that defines the rest of the SubShader goes here
Pass
{
Offset 0, [_OffsetUnitScale]
// The code that defines the rest of the Pass goes here
}
}
}
HLSL 코드에서 머티리얼 프로퍼티를 사용하여 변수 값을 설정하려면 머티리얼 프로퍼티에 셰이더 프로퍼티와 같은 이름을 지정하십시오.
실제 작동하는 코드 예제가 포함된 다음 문서에서 이 기법을 확인할 수 있습니다.