Unity development case RollABoll (5) uses prefabs to create food game objects

In this section, we need to create a prefab to complete the creation of food in the game object.

First, we need to create a folder named prefabs in the project folder so that we can better manage the prefabs.

Then we need to create "food" first.

Here we use cubes to create food.

Of course, in order to better resemble the objects in the game, we need to do some processing on the newly created cube.

Such as zooming out, creating materials, rotating, etc., these are created by personal ideas, and there is no unified standard.

The approximate effect here is as follows:

Next, we need to use this game object to create a prefab.

The steps to create a prefab are also very simple, just drag the previously created game object into the previously created prefabs folder.

After creation, the effect will be as shown below:

Then, just copy the prefab, drag and drop it to the corresponding position in the scene.

The finished effect is as follows:

 

Guess you like

Origin blog.csdn.net/qq_51196701/article/details/123023526