SHARE
TWEET

Untitled

a guest Mar 19th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. GetComponent<Renderer>().sharedMaterial.SetTextureOffset("_MainTex",offset);
  2.      
  3. public class BackGround : MonoBehaviour {
  4.  
  5.     public float speed = 0.1f;
  6.  
  7.     // Use this for initialization
  8.     void Start () {
  9.  
  10.     }
  11.  
  12.     // Update is called once per frame
  13.     void Update () {
  14.         float y = Mathf.Repeat(Time.time * speed,1);
  15.         Vector2 offset = new Vector2(0,y);
  16.         GetComponent<Renderer>().sharedMaterial.SetTextureOffset("_MainTex",offset);
  17.         //Debug.Log(y);
  18.     //    Debug.Log("Time.time: " + Time.time + "y: " +y);
  19.  
  20.     }
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top