GameBall Prefab

The final object we need to make our game an actual game is our ball. In this section, we will create a sphere, add a couple of classes and a rigid body, apply a material, and then turn the object into a Prefab. This will be short and sweet. Let's follow the given steps:

  1. Start off by creating a sphere and ensuring that it is not a child of anything in the Hierarchy view.
  2. Rename the sphere to GameBall.
  3. Set its Position to 0,0,0 and its Scale to 0.07,0.07,0.07:
  1. In the Project view, right-click on the Materials folder. Click on Create and then click on Material.
  2. Name the new material GameBall and set the Albedo RGB values to 255,255,0--a very bright yellow.
  3. Select the GameBall material in the Project view, drag it on top of the GameBall object, and drop it:

Now we have a yellow sphere sitting on top of the camera, which we cannot quite see. Now we need to add some code and a component before we can turn this into our game object. First though, we need to take a moment to look at Tag and Layer.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.131.72