You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
417 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class MaterialMover : MonoBehaviour
  5. {
  6. public float scrollSpeed = 0.5F;
  7. public Renderer rend;
  8. void Start()
  9. {
  10. rend = GetComponent<Renderer>();
  11. }
  12. void Update()
  13. {
  14. float offset = Time.time * scrollSpeed;
  15. rend.material.SetTextureOffset("_MainTex", new Vector2(0, offset));
  16. }
  17. }