using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Test : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
public float scrollSpeed = 0.5f;
// Update is called once per frame
void Update()
{
float offset = Time.time * scrollSpeed;
gameObject.GetComponent<MeshRenderer>().sharedMaterial.SetTextureOffset("_MainTex", new Vector2(0, offset));
}
}
![](https://img-blog.csdnimg.cn/img_convert/ac1fa9ad75344f1bd7ae4882190aa1e2.png)
![](https://img-blog.csdnimg.cn/img_convert/a72e75ee66d5f057bd8dec8933656790.png)