Advertisement
laiba_97
Apr 3rd, 2025
13
0
Never
This is comment for paste Untitled
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. After rewatching the video, I realized that line 19, which handles transforms (`transform.position = transform.position + (Vector3.left * moveSpeed) * Time.deltaTime;`), was missing in the script provided in the link under "Scripts."
  2. Also the if condition in written Script is mentioned as ">" that is mismatched in the video that is "<". So the correct script that would make the game properly run would be:
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6.  
  7. public class PipeMoveScript : MonoBehaviour
  8. {
  9. public float moveSpeed = 5;
  10. public float deadZone = -45;
  11.  
  12. // Start is called before the first frame update
  13. void Start()
  14. {
  15.  
  16. }
  17.  
  18. // Update is called once per frame
  19. void Update()
  20. {
  21. transform.position = transform.position + (Vector3.left * moveSpeed) * Time.deltaTime;
  22. if (transform.position.x < deadZone)
  23. {
  24. Destroy(gameObject);
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement