Creating the Prefab for the player and the cake

To create the Prefabs for our game, we need first to create a Prefab folder in our Project. You can do this by following these steps:

  1. Right-click (in our Prefab folder) and select Create Prefab. We need to do this twice and rename them respectively Cake and Player.
  2. From the Hierarchy panel, we need to drag the Player into the Player prefab and Angel's Cake into Angel's Cake prefab(as it was obvious). As you can see, they become blue in the Hierarchy panel. This is fine because now they are linked to the Prefab, as we were saying in the previous section.

As a result, we can easily drag and drop the components we need ready to go, whenever we need them. We can remove all of the instances of the cakes and the player from the Scene since we can drag and drop the Prefabs from the Project panel now. Before we leave the chapter, there is one more thing to do… Build our map!

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

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