5.3 Order

用于指定其所在属性的排序优先级,order 越小排列越靠前

用法

Order(int) :接受一个整数作为排序参数,值越大排列越靠后

代码示例

Shader "BZGUITest/Order"
{
    Properties
    {
        [MT][Order(40)]_T1("MainTex", 2D) = "White"{}
        [MT][Order(30)]_T2("SecondTex", 2D) = "White"{}
    }
    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.2,0.2,1);
            }
            ENDCG
        }
    }
      CustomEditor "BZTA.BZShaderGUI"
}