Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Scrollbackground : MonoBehaviour
  6. {
  7.  
  8. public float scrollSpeed;
  9.  
  10. private Vector3 posicioini;
  11. private float tamañofondo;
  12.  
  13.  
  14. void Start()
  15. {
  16. posicioini = transform.position;
  17. tamañofondo = transform.localScale.y; //Tamaño A mover Scroll
  18.  
  19.  
  20. }
  21.  
  22.  
  23. void Update()
  24. {
  25. float newPosition = Mathf.Repeat(Time.time * scrollSpeed, tamañofondo);
  26. transform.position = posicioini + Vector3.up * newPosition;
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement