Nerd For Tech
Published in

Nerd For Tech

Prefabs in Level Design

Objective: Use Unity’s Prefab system to create unique objects that can be used over and over in your scene.

A Prefab asset is like a blueprint that can be used to create instances of the same object over and over. A Prefab also allows you to change all the objects by just changing the Prefab object.

I will use a Prefab to create some unique floor tiles by combining two different objects. I have downloaded some Floor Assets and have chosen the two that I want to use.

First I will create a folder under Assets called Prefab and a subfolder called Floor. This is where I will store the Prefab Object.

Next, I will combine the two floor objects and rename it New Floor

Now to turn this into a Prefab, all I need to do is drag it into the Prefabs folder and select Original Prefab in the popup message.

Now that I have this tile setup as a Prefab, I can drag it into the Scene and I can also duplicate it to create a larger floor area.

One advantage of using a Prefab is that you can change just one object and have the changes updated to all the other objects. I will demonstrate below by changing the position of the raised element in the object and applying the changes will affect all of the prefab objects in the scene.

Happy Coding!!!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store