-
-
Notifications
You must be signed in to change notification settings - Fork 34
Home
Try changing the mass and linear drag on the Rigidbody component of your AI paddle. Reducing the mass and drag allows the paddle to more easily switch directions, which will help it to be in the right place at the right time to hit the ball. Be careful though, because you also create the opposite problem where the paddle never misses. Adjust the numbers to your preference. You can also change the speed
property that we added to the paddle script to make it faster or slower overall.
A common mistake here is dragging the GameManager.cs
file into the field rather than the "Game Manager" object in your scene. After dragging in the scene object, you should see the functions available on each component attached to that object, including the functions made available in our script.
The other common mistake is not marking your functions as public
in your code. Only public functions are available in the menu.
public void PlayerScores()
{
//...
}
public void ComputerScores()
{
//...
}