(四)创建master material
2022-12-24 本文已影响0人
Nick_4438
简介
在项目中如果每一个对象都要创建对应的material 将会导致工作量很大,于是我们期望可以创建一个master material,然后我们可以根据master material,创建material 实例。复用相关材质。
操作步骤
-
创建一个material 命名为:M_MASTER,编辑material,使用Texture 、tint、constant、multiply配置
-
变换constant、Texture sample为变量
-
添加staticSwitchParameter,使其可判断参数条件
-
成品如下:

- 使用master material 创建 material instance,命名为:MI_Sphere

-
拖动MI_Sphere到对象上应用该material instance
-
双击MI_Sphere,可看到该材质实例的参数配置页面

操作技巧
- 右键 constant可以转换constant为参数,参数可以配置默认值、最大值、最小值
- 右键texture sample也可以转变成为参数