public void CreateMainPoint() { GameObject ball = Instantiate(this.ball, this.transform); ball.name = "Ball"; if (trajectory != null) { trajectory.AddMainPoint(ball); } else { trajectory = new Trajectory(ball); } TextMesh text = ball.GetComponentInChildren <TextMesh>(); text.text = (trajectory.NumMainPoint()).ToString(); }