public void AttachBall(GameObject ball) { ball.transform.parent = transform; ball.transform.localPosition = new Vector3(0, 0.175f, 0); ball.GetComponent <Collider2D> ().enabled = false; BallMovement ballScript = ball.GetComponent <BallMovement> (); ballScript.Pause(); attachedBalls.Add(ball); }
private void PauseGame() { GameObject[] balls = GameObject.FindGameObjectsWithTag("Ball"); for (int i = 0; i < balls.Length; i++) { GameObject ball = balls[i]; BallMovement script = ball.GetComponent <BallMovement>(); if (script != null) { script.Pause(); } } }