Untitled
using System.Collections; using System.Collections.Generic; using UnityEditor.Search; using UnityEngine; public class crosshairScript : MonoBehaviour { public Transform Ball; public Rigidbody2D rb; public GameObject screen; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { rb.position =new Vector2 (Ball.position.x, rb.position.y); if(screen.GetComponent<ScreenScript>().BallOutOfBound == false) { GetComponent<Renderer>().enabled = false; } if(screen.GetComponent<ScreenScript>().BallOutOfBound == true) { GetComponent<Renderer>().enabled = true; } } }
Leave a Comment