Unity2020.4 UVスクロール
1.画像を用意
2.スプライトだったらテクスチャー(Default)に変更
3.WrapModeをRepeatに変更
4.Materialを用意
5.Shaderを Unlit/Textureに変更
6.スクリプトを用意
using System.Collections; using System.Collections.Generic; using UnityEngine; public class UVscrool : MonoBehaviour { public float speed = 1; float current; void Update() { float scroll = Mathf.Repeat(Time.time * 0.2f, 1); Vector2 offset = new Vector2(scroll, 0); GetComponent<Renderer>().sharedMaterial.SetTextureOffset("_MainTex", offset); } }
7.Quadを作成
8.Quadにマテリアルとスクリプトを追加
9.QuadのMeshColliderを削除