Sorry to resurrect this topic, but being a related question I think is the best place.
I'm using material overrides in the sprite collection for my tilemap.
The material is animated with this shader:
Shader "Custom/2DToolkit_AnimatedTexture"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
// Create the inspector values
_FrameWidth ("Frame Width", Float) = 0.0
_TotalFrames ("Total Frames", Float) = 0.0
_FPS ("FPS", Float) = 0.0
}
SubShader
{
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 100
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct v2f
{
float4 vertex : SV_POSITION;
half2 texcoord : TEXCOORD0;
};
sampler2D _MainTex;
float4 _MainTex_ST;
//Create the connection to the properties inside of the
//CG program
float _FrameWidth;
float _TotalFrames;
float _FPS;
float _Tick;
v2f vert (appdata_base v)
{
v2f o;
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
//o.texcoord = mul(_Object2World, v.vertex).xy * _MainTex_ST.xy + _MainTex_ST.zw;
return o;
}
fixed4 frag (v2f i) : COLOR
{
//ANIMATION
float2 spriteUV = i.texcoord;
_Tick = frac(_Time.y * _FPS);
spriteUV.x = spriteUV.x + ( floor( _Tick * _TotalFrames ) * _FrameWidth );
fixed4 col = tex2D(_MainTex, spriteUV);
return col;
}
ENDCG
}
}
}Here is the test texture for the material:

And here the shader inspector:

The performance is great and the animations works perfectly with all sprites except with the water tiles.
The tile is not drawn correctly and consequently the animation has an ugly result.

Where is the problem?
I've been playing with the sprite collection settings with no success and I'm lost.
Thank you.