Unity/Unity Graphics
Unity Tags
붕대마음
2016. 4. 12. 11:57
반응형
RenderType 관련 태그
ex) Tags { "RenderType"="Opaque"}
link : http://docs.unity3d.com/Documentation/Components/SL-ShaderReplacement.html
LightMode 관련 태그
ex) Tags { "LightMode" = "Vertex"}
link : http://docs.unity3d.com/Documentation/Components/SL-PassTags.html
유니티에 설정되어져 있는 built in tags에 커스텀 tag를 추가하여 Material.GetTag 함수로
사용할 수 있다.
SubShader
{
Tags { ... MyTag"="tagType1" }
.....
위와 같은 식으로 셰이더 파일에서 설정 해 주고 아래와 같이 사용하면 된다.
Material m = myMaterial;
string shaderTag = m.GetTag("MyTag", false, "Nothing");
if(shaderTag == "Nothing")
log("not found MyTag");
else
log("found MyTag, Value is " +shaderTag);
참고
-