Before we dig deep into the theory, let's take some time to make a class and see it in action.
First, we will need to create a sphere in our Hierarchy view:
- Click on the Create button.
- Hover over 3D object and click on sphere.
- Name the sphere Ball.
- In the Inspector, make sure that all position elements are 0. Alternatively, you can simply click on the gear icon and select reset.
- With the sphere reset, change its position.x to 3.05, position.y to 0.87, and position.z to 4.15.
Now, we will add a script file to the ball:
- Click on the Add Component button in the Inspector.
- Scroll down to New Script and click on it.
- Name the script LaunchBall; click on Create and then on Add.
- Double-click on the Launchball script in the Inspector. ...