Animated sprite

Animated

Shader

Shader "Shaders/Sprites/CustomDefault"
{
    Properties
    {
        [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
    _Offset ("Offset (RGB)", 2D) = "white" {}
    _Amount ("Offset Scale Amount", Range(0,1)) = 0.5
    _Speed ("Offset Scale Amount", Range(0,1)) = 0.5
        _Color ("Tint", Color) = (1,1,1,1)
        [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
    }

    SubShader
    {
        Tags
        {
            "Queue"="Transparent"
            "IgnoreProjector"="True"
            "RenderType"="Transparent"
            "PreviewType"="Plane"
            "CanUseSpriteAtlas"="True"
        }

        Cull Off
        Lighting Off
        ZWrite Off
        Blend One OneMinusSrcAlpha

        Pass
        {
        CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #pragma multi_compile _ PIXELSNAP_ON
            #pragma shader_feature ETC1_EXTERNAL_ALPHA
            #include "UnityCG.cginc"

            #define IF(a, b, c) lerp(b, c, step((fixed) (a), 0))

            uniform float _Amount;
            uniform float _Speed;

            struct appdata_t
            {
                float4 vertex   : POSITION;
                float4 color    : COLOR;
                float2 texcoord : TEXCOORD0;
                float2 tex2  : TEXCOORD1;
            };

            struct v2f
            {
                float4 vertex   : SV_POSITION;
                fixed4 color    : COLOR;
                float2 texcoord  : TEXCOORD0;
                float2 tex2  : TEXCOORD1;
            };

            fixed4 _Color;

            v2f vert(appdata_t IN)
            {
                v2f OUT;
                OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
                OUT.texcoord = IN.texcoord;
                OUT.tex2 = IN.tex2;
                OUT.color = IN.color * _Color;
                #ifdef PIXELSNAP_ON
                OUT.vertex = UnityPixelSnap (OUT.vertex);
                #endif

                return OUT;
            }

            sampler2D _MainTex;
            sampler2D _AlphaTex;
            sampler2D _Offset;

fixed4 SampleSpriteTexture (float2 uv, float2 uv2)
{
    // Sample the offset texture
    fixed4 offset = tex2D (_Offset, uv);

    // Rotate the uv offset in a circle over the target texture
    float v = _Amount * offset[0];
    float x = uv[0] + v * lerp(-1.0, 1.0, sin(_Time[1] * _Speed));
    float y = uv[1] + v * lerp(-1.0, 1.0, cos(_Time[1] * _Speed));
    x = IF(x < 0, 1.0 - x, IF(x > 1, x - 1.0, x));
    y = IF(y < 0, 1.0 - y, IF(y > 1, y - 1.0, y));

    fixed4 color = tex2D (_MainTex, float2(x, y));
#if ETC1_EXTERNAL_ALPHA
    // get the color from an external texture (usecase: Alpha support for ETC1 on android)
    color.a = tex2D (_AlphaTex, uv).r;
#endif //ETC1_EXTERNAL_ALPHA

    return color;
}

            fixed4 frag(v2f IN) : SV_Target
            {
                fixed4 c = SampleSpriteTexture (IN.texcoord, IN.tex2) * IN.color;
                c.rgb *= c.a;
                return c;
            }
        ENDCG
        }
    }
}

Shader Notes

Very similar to the animated surface shader, this shader simply rotates over the texture sheet.

However, notice that it renders using the sprite rendering method, and correctly uses sprite sort order.