In the process of making a game, you will need to create multiple identical gameobject by code, such as bullets in shooting games, miscellaneous soldiers and many others.
Commonly called prefab prefabrication in Unity, it acts as a template and can replicate the same gameobject quickly.
Creating Prefab Precast Parts
In general, separate catalogs are created to store prefabricated parts.
The first of these methods
Add a gameobject to the scene to complete the relevant settings. and drag it into the assets/prefabs.
The second method of
In Assets/prefabs, new empty precast parts
Then drag the gameobject in the scene to the top
Prefab precast parts are synchronized with their generated objects
The gameobject in the figure has three options:
Select positioning precast parts;
Revert Reset the Current property = The properties of the prefab;
Apply saves the current property and updates it to the prefab properties.
Created in code
Created using the instantiate method. For example:
Gameobject OGame = Instantiate (_prefab);
Unity Learning Note: creation and use of precast parts prefab