karen_constantine

Untitled

Apr 9th, 2023
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class PipeController : MonoBehaviour
  4. {
  5. public float speed = 2f;
  6. public float xLimit = -10f;
  7.  
  8. void Update()
  9. {
  10. transform.position += Vector3.left * speed * Time.deltaTime;
  11. if (transform.position.x < xLimit)
  12. {
  13. Destroy(gameObject);
  14. }
  15. }
  16. }
  17.  
Advertisement
Add Comment
Please, Sign In to add comment