Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class ScrollTexture : MonoBehaviour
  6. {
  7.     public float scrollSpeedX = 0f;
  8.     public float scrollSpeedY = 0f;
  9.     Renderer rend;
  10.  
  11.     void Start()
  12.     {
  13.         rend = GetComponent<Renderer>();
  14.     }
  15.  
  16.     void Update()
  17.     {
  18.         float offsetx = Time.time * scrollSpeedX;
  19.         float offsety = Time.time * scrollSpeedY;
  20.         rend.material.SetTextureOffset("_MainTex", new Vector2(offsetx, offsety));
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement