Search Unity

_Time in Shader is unstable, so the uv move is not smooth.

Discussion in 'Animation' started by llxwd008, Apr 16, 2022.

  1. llxwd008

    llxwd008

    Joined:
    Aug 7, 2015
    Posts:
    49
    Hi,
    I need a simple uv move anim for wall in my proj, I use just simple shader as blow:

    v2f vert (appdata v)
    {
    v2f o;
    o.vertex = UnityObjectToClipPos(v.vertex);
    o.uv = TRANSFORM_TEX(v.uv, _MainTex);

    float offset = _Time.x * _Speed;
    o.uv.x = o.uv.x + offset;

    return o;
    }

    It works fine on PC, but on mobile phone, the uv move is not smooth, very unstable. I think it's because the delta time is stable un PC, but not stable on phone, so the _Time change is unstable too. But how could I fix it, in my shader?