将 vector 分量独立绘制,可以通过参数的多少来控制,绘制那些分量,这个标签会单独绘制每一个分量
V4S(name1) :绘制 Vector 中的任意一个分量
V4S(name1,name2):绘制 Vector 中的任意两个分量
V4S(name1,name2,name3):绘制 Vector 中的任意三个分量
V4S(name1,name2,name3,name4):绘制 Vector 中的任意四个分量
Shader "BZGUITest/V4S"
{
Properties
{
[Header(OneComponent)]
[V4S(OnlyX)]_V1("TilingOffset", Vector) = (1,2,1,2)
[Header(TwoComponent)]
[V4S(X,Y)] _V2("SingleLine", Vector) = (1,2,1,2)
[Header(ThreeComponent)]
[V4S(First,Second,Third)]_V3("SingleLine", Vector) = (1,2,1,2)
[Header(FourComponent)]
[V4S(First,Y,Third,W)] _V4("SingleLine", Vector) = (1,2,1,2)
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
return half4(1,0.5,0.2,1);
}
ENDCG
}
}
}