插件放置于 Unity 官方商城
在商城购买完成后,便可以在 unity 的PackageManager 中找到 myasset ,然后进行下载导入安装
在项目设置中开启插件配置,是插件生效
绘制类标签直接添加在属性前面即可,无需指定 CustomEditor
分组类标签需要将着色器的 CustomEditor 设置为 CustomEditor “BZTA.BZShaderGUI”
Shader "BZShaderGUITest/ToggleShow"
{
Properties
{
[TG(Test)] [Toggle]_tg("tg1",float) = 0
[TG(Test)] [Color(1,2,3,4)]_Color1("Color1", color) = (1,1,1,1)
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile __ _TG_ON
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
};
half4 _Color1;
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
{
#if _TG_ON
return _Color1;
#else
return half4(1,0,0,1);
#endif
}
ENDCG
}
}
CustomEditor "BZTA.BZShaderGUI"
}