void makeBall(float x, float y, Color color) { GameObject ball = Instantiate(ballPrefab); BallMoveScript ballMover = ball.GetComponent <BallMoveScript>(); ball.GetComponent <Renderer>().material.color = color; }
void makeBall(float x, float y, Color color) { GameObject ball = Instantiate(ballPrefab); BallMoveScript ballMover = ball.GetComponent <BallMoveScript>(); ballMover.x = x; ballMover.y = y; ballMover.xSpeed = Random.Range(0.01f, .3f); ballMover.ySpeed = Random.Range(0.01f, .3f); ball.GetComponent <Renderer>().material.color = color; }