The first is the shader infrastructure:
1Shader"Custom/example2 {3 properties//Variable Properties panel4 {5 }6 Subshader7 {8Tags {"Rendertype"="Opaque"}//Setting rendering status and labels9Lod -Ten Pass One {//Start CG code snippet A Cgprogram - #pragmaVertex vert//vertex shader - #pragmaFragment frag//Fragment Shader the#include"Unitycg.cginc" - - structAppData; - structv2f; + v2f Vert (AppData v) {} - fixed4 Frag (v2f i): sv_target{} + ENDCG A } at } -}
Then the properties panel is defined:
Actual code:
1 Properties2 {3_mycolor ("MyColor", Color) = (1,1,1,1) 4_myvector ("Myvector", Vector) = (1,2,3,4)5_myrange ("MyRange", Range (1, -))=16_myfloat ("myfloat",float)=0 7_my2d ("my2d", 2D) =" White"{}//white refers to the default output color without a picture8_my3d ("My3d", 3D) =" White"{}9_mycube ("Mycube", Cube) ="_skybox" { }Ten}
Panel effect:
Unity Shader Learning Notes (1) Shader infrastructure and properties panel