TileUvSin.cs 580 Bytes
using UnityEngine;
using System.Collections;

public class TileUvSin : MonoBehaviour
{
    public Vector2 maxMovement;
    public float speed;

    private float _timer = 0;
    private Vector2 _initTile;
    private Renderer _r;

    private void Start()
    {
        _r = GetComponent<Renderer>();
        _initTile = _r.material.mainTextureScale;
    }

    void Update ()
    {
        float sin = Mathf.Sin(_timer * speed);
        Vector2 thisSin = maxMovement * sin;
        _r.material.mainTextureScale = thisSin + _initTile;
        _timer += Time.deltaTime;
    }
}