https://docs.unity3d.com/Manual/SL-Properties.html
Shader "Custom/BasicDiffuse" { //http://docs.unity3d.com/Manual/SL-Properties.html Properties { //变量名 ("GUI Inspector面板上显示的名称", 变量类型) = 默认值 _My2D ("My 2D", 2D) = "white" {} _My3D ("My 3D", 3D) = "white" {} _MyColor ("My Color", Color) = (1, 1, 1, 1) _MyRange ("My Range", Range(0, 10)) = 2.5 _MyFloat ("My Float", Float) = 2.5 //legacy,Int是由Float提供支持,不是真正的整型类型 _MyInt ("My Int", Int) = 2 //Integer是真正的整型类型 _MyInt ("My Int", Integer) = 2 _MyVector ("My Vector", Vector) = (1, 2, 5, 10) _MyCube ("My Cube", Cube) = "" {} } SubShader { Tags { "RenderType"="Opaque" } LOD 200 CGPROGRAM #pragma surface surf Lambert sampler2D _MainTex; struct Input { float2 uv_MainTex; }; void surf (Input IN, inout SurfaceOutput o) { half4 c = tex2D (_MainTex, IN.uv_MainTex); o.Albedo = c.rgb; o.Alpha = c.a; } ENDCG } FallBack "Diffuse" }
Properties
{
[PerRendererData]
_MainTex("Albedo", 2D) = "white" {}
_Color("Color", Color) = (1.0, 1.0, 1.0, 1.0)
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
_Fade("Alpha Fade", Range(0.0, 1.0)) = 1.0
[Toggle(_EMISSION)]
_EnableEmission("Enable Emission", Float) = 0.0
[HDR] _EmissiveColor("Emissive Color", Color) = (0.0, 0.0, 0.0, 1.0)
[Enum(UnityEngine.Rendering.BlendMode)]
_SrcBlend("Source Blend", Float) = 1 // "One"
[Enum(UnityEngine.Rendering.BlendMode)]
_DstBlend("Destination Blend", Float) = 10 // "OneMinusSrcAlpha"
[Enum(UnityEngine.Rendering.BlendMode)]
_SrcBlendAlpha("Source Blend Alpha", Float) = 1 // "One"
[Enum(UnityEngine.Rendering.BlendMode)]
_DstBlendAlpha("Destination Blend Alpha", Float) = 1 // "One"
[Enum(UnityEngine.Rendering.BlendOp)]
_BlendOp("Blend Operation", Float) = 0 // "Add"
[Enum(UnityEngine.Rendering.CompareFunction)]
_ZTest("Depth Test", Float) = 4
[Enum(UnityEngine.Rendering.CullMode)]
_CullMode("Cull Mode", Float) = 0
[Enum(UnityEngine.Rendering.CompareFunction)]
_StencilComp("Stencil Comparison", Int) = 0
[Enum(UnityEngine.Rendering.StencilOp)]
_StencilOp("Stencil Operation", Int) = 0
_StencilWriteMask("Stencil Write Mask", Range(0, 255)) = 255
_StencilReadMask("Stencil Read Mask", Range(0, 255)) = 255
}
Pass
{
Name "Main"
Tags{ "LightMode" = "UniversalForward" }
LOD 100
Blend[_SrcBlend][_DstBlend],[_SrcBlendAlpha][_DstBlendAlpha]
BlendOp[_BlendOp]
ZTest[_ZTest]
ZWrite[_ZWrite]
Cull[_CullMode]
Offset[_ZOffsetFactor],[_ZOffsetUnits]
ColorMask[_ColorMask]
Stencil
{
Ref[_Stencil]
Comp[_StencilComp]
Pass[_StencilOp]
ReadMask[_StencilReadMask]
WriteMask[_StencilWriteMask]
}
}