unity3d中怎么用代码换材质,不要用拖进去的方法,要动态加载材质的方法。
1个回答
展开全部
mat = new Material( "Shader \"Hidden/Alpha\" {" +
"SubShader {" +
" Pass {" +
" ZTest Always Cull Off ZWrite Off" +
" Blend DstAlpha Zero" +
" Color (1,1,1,1)" +
" }" +
"}" +
"}"
);
这是代码新建的
如果是动态换,声明Material mat 然后gameObject.renderer.material = mat;
"SubShader {" +
" Pass {" +
" ZTest Always Cull Off ZWrite Off" +
" Blend DstAlpha Zero" +
" Color (1,1,1,1)" +
" }" +
"}" +
"}"
);
这是代码新建的
如果是动态换,声明Material mat 然后gameObject.renderer.material = mat;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询