Unity 版本:2020.3.23
此教程会长期更新,欢迎大家关注!!!
博主微信号:ITComputerGraph
Properties 材质属性,每个属性占一行
name ("display text in Inspector", type name) = default value
变量名("Unity材质面板显示的名称", 变量类型) = 变量默认值
举例说明
_TintColor ("Main Color", Color) = (1, 1, 1, 1)
_TintColor 是属生的变量名,"Main Color" 是材质面板上显示的内容,Color 是变量的类型
(1, 1, 1, 1) 是变量的默认值,RGBA四个分量都为 1
常用属性类型及声明方法
Properties
{
//RGBA四个通道的颜色
_TintColor("Main Color", Color) = (1, 1, 1, 1)
//Vector,可以理解为一个长度为 4 的Float数组
_TestVector("Example vector", Vector) = (-1.8, 0, 0.25, 1.2)
//Int 值
_TestInt("Int display name", Int) = 1
//Float 值
_TestFloat("Float display name", Float) = 0.5
//设置最大和最小值,材质面板有滑动条的Float值
_TestRange("Float with range", Range(0.0, 1.0)) = 0.5
//2D图片
_TestTexture2D("Texture2D display name", 2D) = "white" {}
//Cubemap
_TestCubemap("Cubemap", Cube) = "white" {}
}