skewing.cs 609 B

1234567891011121314151617181920212223
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class skewing : MonoBehaviour
  5. {
  6. MeshRenderer mr;
  7. public Material material;
  8. public Material material1;
  9. float offset;
  10. public float scrollSpeed = 0.5F;
  11. private void Start()
  12. {
  13. //mr = GetComponent<MeshRenderer>();
  14. }
  15. void Update()
  16. {
  17. offset = -Time.time * scrollSpeed;
  18. //mr.materials[0].mainTextureOffset = new Vector2(-offset, 0);
  19. material.mainTextureOffset = new Vector2(-offset, 0);
  20. material1.mainTextureOffset = new Vector2(-offset, 0);
  21. }
  22. }