To automate the activation and deactivation of games we will modify the BallGame script to take care of that for its game objects. Edit BallGame.cs and add the following functions to enable or disable the ball, court, and goal:
File: BallGame.cs
public void Activate() { BallThrowControl.gameObject.SetActive(true); CourtGameObject.SetActive(true); GoalCollisionBehavior.gameObject.SetActive(true); } public void Deactivate() { BallThrowControl.gameObject.SetActive(false); CourtGameObject.SetActive(false); GoalCollisionBehavior.gameObject.SetActive(false); }