Skip to content

Commit 4dbe158

Browse files
committed
Fix broken instancing
1 parent f10b955 commit 4dbe158

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Runtime/Shaders/Mobile-Diffuse-MeshAnimation.shader

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ Shader "Mobile/Diffuse (Mesh Animation)" {
2323

2424
float4 _AnimMul;
2525
float4 _AnimAdd;
26-
float _AnimLoop;
2726

2827
UNITY_INSTANCING_BUFFER_START(Props)
2928
UNITY_DEFINE_INSTANCED_PROP(float4, _AnimTime)
29+
UNITY_DEFINE_INSTANCED_PROP(float, _AnimLoop)
3030
UNITY_INSTANCING_BUFFER_END(Props)
3131

3232
struct appdata
@@ -47,9 +47,10 @@ Shader "Mobile/Diffuse (Mesh Animation)" {
4747
UNITY_SETUP_INSTANCE_ID(v);
4848

4949
float4 t = UNITY_ACCESS_INSTANCED_PROP(Props, _AnimTime);
50+
float looping = UNITY_ACCESS_INSTANCED_PROP(Props, _AnimLoop);
5051

5152
float progress = (_Time.y - t.w) * t.z;
52-
float progress01 = lerp(saturate(progress), frac(progress), _AnimLoop);
53+
float progress01 = lerp(saturate(progress), frac(progress), looping);
5354
float4 coords = float4(
5455
0.5 + v.vertexId,
5556
0.5 + t.x + progress01 * t.y,

0 commit comments

Comments
 (0)