Skip to content
Adam Graham edited this page Jan 18, 2022 · 26 revisions

FAQs


The AI keeps missing the ball. How can I adjust this?

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.


There are no functions available to select for the score trigger

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()
{
    //...
}
Clone this wiki locally